[button]

The shortcode is a versatile WordPress shortcode that allows you to create customizable buttons with various functionalities, such as linking to external URLs, opening modals, or triggering video pop-ups.


Product


Shortcode Attributes

  1. url – The URL the button should link to. If provided, the button acts as a link.
    • Options: Any URL.
  2. title – Used to change button text labels.
    • Default: View.
    • Options: Any text value.
  3. target – Specifies the target attribute for the link.
    • Options:
      • _blank: Opens in a new tab or window.
      • _self: Opens in the same frame or tab.
      • _parent: Opens in the parent frame or tab.
      • _top: Opens in the main window, cancelling other frames.
  4. data_open – If provided, the button will open a modal. The value can be a modal ID or a custom identifier.
  5. video_open – If provided, the button will trigger a video pop-up using Fancybox. The value should be Youtube or Vimeo URL only.
  6. classes – Specifies additional CSS classes for styling the button.

Example Usage

[button url="https://example.com" title="Click Me" target="_blank"]Visit Example[/button]
[button data_open="modal-1" title="Open Modal"]Open Modal[/button]
[button video_open="https://www.youtube.com/watch?v=example" title="Watch Video"]Play Video[/button]

Results

Example 1:
In this shortcode creates a button that links to https://example.com with the text Visit Example. The link opens in a new tab.

Example 2:
In this shortcode creates a button that opens a modal with the ID modal-1.

Example 3:
In this shortcode creates a button that triggers a video pop-up. The video URL is https://www.youtube.com/watch?v=example.
The data_open and video_open functionalities rely on JavaScript libraries (e.g., Fancybox) being properly initialized in your theme.