Forums

Why don't shortcodes work in sidebar widgets? (3 posts)

  1. OM2
    Member
    Posted 2 years ago #

    I've written a basic plugin using shortcodes that shows the contents of a post when you type the shortcode

    This seems to work OK in posts and pages

    But: it doesn't work OK in widgets sidebars - I'm trying on the text box widget

    Why is this?
    And how can I make work?

    Thanks

    Omar

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Shortcodes normally rely on the post content filters/actions in order to be parsed, from what I recall. However, I'm pretty sure that the Contact Form 7 plugin uses shortcodes that will work in sidebar widgets. It might be worth downloading that plugin just to see how the author achieved this.

  3. MichaelH
    Volunteer
    Posted 2 years ago #

    This seems to allow shortcode in widgets:
    * http://wordpress.org/extend/plugins/shortcode-exec-php/

    Or these that allow php code in widgets so you could use <php echo do_shortcode('[your shortcode here]'); ?>
    * http://wordpress.org/extend/plugins/exec-php/
    * http://wordpress.org/extend/plugins/php-code-widget/

Topic Closed

This topic has been closed to new replies.

About this Topic