Support » Fixing WordPress » Shortcode in widgets not working

  • smoore217

    (@smoore217)


    Hi,

    I cannot get shortcodes to work in text widgets to save my life. I heard that this is enabled by default in the latest wordpress, however it will not work. I also tried adding add_filter(‘widget_text’, ‘do_shortcode’); to my functions.php file for the theme, but the shortcode still shows up as a string. Was this feature broke in the newest version of wordpress?

Viewing 15 replies - 1 through 15 (of 19 total)
  • esmi

    (@esmi)

    Forum Moderator

    I heard that this is enabled by default in the latest wordpress

    Then I’m afraid your sources were incorrect.

    smoore217

    (@smoore217)

    It was probably from 6 months ago when this: http://core.trac.wordpress.org/ticket/10457 had the release set for version 3.3. Anyway, my problem still stands.

    esmi

    (@esmi)

    Forum Moderator

    If you check the Trac ticket, it’s been changed to “Future Release”. At present, the only shortcodes that will work in widgets are those specially created by plugins.

    smoore217

    (@smoore217)

    Can you move this to the plugins&hacks forums then as this is a known hack and deals with troubleshooting it.

    esmi

    (@esmi)

    Forum Moderator

    It’s not a known hack and it does belong in this forum.

    smoore217

    (@smoore217)

    If it isn’t a known hack, then why are there tons of articles littering the internet with the add_filter(‘widget_text’, ‘do_shortcode’); solution I attempted?
    http://digwp.com/2010/03/shortcodes-in-widgets/
    http://www.wprecipes.com/how-to-add-shortcodes-in-sidebar-widgets
    http://dannyvankooten.com/630/enabling-shortcodes-in-widgets-quick-wordpress-tip/
    http://englishmike.net/wordpress/2008/07/07/wordpress-quick-tips-3adding-a-shortcode-to-a-sidebar-widget/

    These all cover the same solution, which is not working. It causes behavior not intended in original design, so I’d consider that a hack.

    esmi

    (@esmi)

    Forum Moderator

    It is not a core hack.

    smoore217

    (@smoore217)

    I don’t think the “plugins and hacks” forum consists of very many core hacks… I’d figure this forum is meant for troubleshooting installation and base functionality problems.

    esmi

    (@esmi)

    Forum Moderator

    Hacks
    – For Plugin Coding and Core hacking discussion

    smoore217

    (@smoore217)

    Plugins and Hacks
    – Extensions and modifications

    This is the forum I wanted it transferred to, not Hacks.

    esmi

    (@esmi)

    Forum Moderator

    That is for plugins only.

    While this semantics argument was entertaining was a solution to this issue ever found? I’m having the same problem.

    Smoore217, did you end up posting this issue elsewhere? Any luck?

    Thanks.

    Michael

    (@alchymyth)

    Forum Moderator

    @clawler

    neither you nor the original poster are clear about what shortcodes you were trying to show in the textwidget of what theme.

    without these details, this is really just a philosophical topic.

    it might possibly be better if your start your own topic and post the necessary details.

    Thanks alchymyth, just wanted to see if a solution ever presented itself.

    Right now I’m using Twenty Eleven in 3.4.2 and it’s with any shortcode I try. I’m also using one of the many single line Shortcode in Widget plugins. I’ve also tried putting add_filter('widget_text', 'do_shortcode'); in the functions file myself, but that didn’t work either.

    Any recommendations?

    Michael

    (@alchymyth)

    Forum Moderator

    it’s with any shortcode I try

    considering that [gallery] and [caption] are the only genuine shortcodes, and that somethings in [brackets] is not always shortcode, what exact other shortcodes have you tried?

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘Shortcode in widgets not working’ is closed to new replies.