Forums

[resolved] Shortcode doesn't work on Pages, but works in Posts (3 posts)

  1. jboveda
    Member
    Posted 1 year ago #

    Hey all,

    Upgraded to latest wordpress (wordpress 3 of this writing) from wpmu, and I've found that my shortcode works fine in posts (including any custom posts created via more fields plugin) but not in pages at all. I've done a search on shortcodes not working and found no reason why this would be.

    Any ideas?

    I'm using a simple shortcode for testing, which works on posts but not on pages. It is reproduced below from my functions.php file:

    function hello() {
        return "hello";
    }
    add_shortcode('hw', 'hello');
  2. esmi
    Theme Diva & Forum Moderator
    Posted 1 year ago #

    Do your page templates use the_content()?

  3. jboveda
    Member
    Posted 1 year ago #

    It does. I had a conditional is_single() which wasn't returning true for pages, so that did it. Thanks for pointing the way!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.