PressTigers

Adding Custom Shortcode in Unyson Framework

Unyson is a drag and drop framework for creating complex WordPress themes with speed and ease. It accompanies a group of built-in extensions such as Drag & Drop Builder, Shortcodes, Sidebars, Styling, Slider, Backup, etc. In this article, you will learn to create custom shortcode in Unyson framework.

For this, you need to create a directory structure in your Theme using the shortcodes extension folder, i.e.

framework-customizations/extensions/shortcodes/shortcodes/{your-shortcodes}

Now open config.php file (containing shortcode configuration) located inside the root directory of shortcodes. Add the following code in it:

The shortcode directory contains an option.php file. Next step is to add your custom shortcode options for back-end using the following code:

The default shortcode view file is located in {your-shortcodes}/views/view.php. It will render the HTML view at front-end. $atts, $content and $tag variables will be passed to view file using the following code:

When the shortcode is rendered, static.php file is then used to enqueue static files using the following code:

The shortcode static files include CSS, JS, and images located in static folder as:

  1. {your-shortcodes}/static/css
  2. {your-shortcodes}/static/js
  3. {your-shortcodes}/static/images

User Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Get in Touch