This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Using a shortcode in SiteOrigin Hero

8 years ago · Last reply by Alex S 8 years ago

I am using the SiteOrigin Hero Widget. Inside of the frame, I would like to use a shortcode of my own plugin:

<p style="text-align: center;">[my_shortcode]

But it only displays

[my_shortcode]

I tried enabling the shortcode for widgets by calling

add_filter('widget_text', 'do_shortcode');

in my plugin and it works for usual WP widgets, but not inside of the SiteOrigin Hero widget. What can I do to make it work?

Thanks in advance,

Kilian

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

3
  1. Alex S Staff 8 years, 3 months ago

    Hi Kilian,

    That’s odd. Shortcodes should be working without issue. Can you please send me a copy of your shortcode so I can run some tests?

  2. laduahu 8 years, 3 months ago

    Hi Alex, thank you for your response. I reproduced the issue with a simple plugin:

    <?php 
    /*
    Plugin Name: my-plugin
    Description: test
    Version: 0.1
    Author URI: mailto:[email protected]
    */
    
    // Enable shortcodes in text widgets
    add_filter('widget_text', 'do_shortcode');
    
    add_action('init', 'my_shortcode_init');
    function my_shortcode_init()
    {
        add_shortcode('my_shortcode', 'my_shortcode_func');
    }
    
    function my_shortcode_func()
    {
    	return 'It works!';
    }

    These are the steps to reproduce it:
    – Install WordPress 4.8.2 with the default Twenty Seventeen theme
    – Install and activate the current SiteOrigin Widgets Bundle Plugin (1.10.2)
    – Activate the my-plugin.php plugin (code above)
    – Add the SiteOrigin Hero widget to the sidebar with [my_shortcode] in the frame
    – Add a text widget to the sidebar with [my_shortcode] as text

    This is the resulting sidebar:

    screenshot

  3. Alex S Staff 8 years, 3 months ago

    Hi Kilian,

    I just double checked the code and I’m mistaken.

    Unfortunately, shortcodes intentionally don’t currently work with the SiteOrighn Hero widget. I’m going to log this as a feature request but in the meantime, I recommend using the SiteOrigin Layout Slider instead. Can’t see this widget? You can activate it by navigating to WP AdminPluginsSiteOrigrn Widgets.

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread