• Resolved jamezon

    (@jamezon)


    Hi,

    It is easy to add shortcode to a text widget by either using a plugin or adding the following to the functions file:

    add_filter( ‘widget_text’, ‘shortcode_unautop’ );
    add_filter(‘widget_text’, ‘do_shortcode’);

    This enables you to use a shortcode such as a date and then displaying a current or dynamic date in your widget sidebar.

    Is there a way to actually enable shortcode execution (specifically for a dynamic or current date) for WordPress Popular Posts?

    The actual shortcode is showing in the side bar and not the date.

    WordPress does not support shortcodes in widgets or the sidebar as far as I know, unless you add a filter.

    Can anyone help please?

    Thanks.

Viewing 3 replies - 16 through 18 (of 18 total)
  • Thread Starter jamezon

    (@jamezon)

    Thanks Hector,

    Without your help I would not have been able to solve the problem.

    I converted the code to a plugin like you suggested and installed everything on a brand new domain. Got all sorts of errors. Then I deactivated the plugin and the shortcode worked.

    After a long investigation, I finally traced the problem to the following:

    If you enable the Ajaxify widget in the tools section of your plugin, then the shortcode will not execute in the sidebar. I had it enabled because of WP Super Cache.

    Thanks again for your help.

    James

    Plugin Author Hector Cabrera

    (@hcabrera)

    Glad to know you got it working ?? Will look into the Ajaxify widget issue though, that shouldn’t happen (or at least no one had reported anything similar until now.)

    Thread Starter jamezon

    (@jamezon)

    Thanks again Hector.

Viewing 3 replies - 16 through 18 (of 18 total)
  • The topic ‘Adding shortcode to Plugin’ is closed to new replies.