Display Posts Shortcode
[resolved] Not working in text widget? (10 posts)

  1. Joelle
    Posted 2 years ago #

    Hi there, awesome plug-in, thanks!

    I'm using WP 3.5 and Display Posts Shortcode 2.3.

    Small issue -- I do have the shortcode bits in my function.php file, but in spite of that, the shortcode doesn't display in my text widget.

    I'm using the example from the docs: [display-posts id="648"] (the ID being the page that I need displayed) Is it because its a page and not a post, specifically? I've tried several other pages and can't get it to display anything. The shortcode doesn't display, just nothing shows.

    I'd really appreciate any insight. Thank you!


  2. Daniel Bachhuber
    Hand Built
    Posted 2 years ago #

    Hey Joelle,

    WordPress doesn't currently offer support for shortcodes in text widgets. You can learn more about the history of that idea here.

  3. Bill Erickson
    Plugin Author

    Posted 2 years ago #

    You can add support for shortcodes in your widgets by adding this to your functions.php file:

    add_filter( 'widget_text', 'do_shortcode' );

  4. Joelle
    Posted 2 years ago #

    Hi there,

    Thanks for your feedback, but I think we're missing my actual question -- perhaps I phrased it poorly. :)

    I've already inserted the do_shortcode filter in my functions.php file, which I mentioned initially. It IS rendering the shortcode, in general.

    However, my question is *why won't it show the contents of a PAGE?* It shows shortcode for posts by category and many other thing, but I can't get it to display the contents of a page, despite having the correct ID in there. Since pages are technically posts, I'm confused.

    I've included the filter in my functions file, I've inserted the shortcode straight from the plugin docs, but it won't show me that post ID -- so I'm asking -- does the display_posts plugins only apply to blog posts and not page content?

    Thanks so much for your insight. :)

  5. Daniel Bachhuber
    Hand Built
    Posted 2 years ago #

    Have you tried passing post_type='page' too?

  6. Joelle
    Posted 2 years ago #

    YAY! Thank you, Daniel. That totally worked. I'm not sure how I overlooked that little nugget of information.

    I am trying to get it to display the actual content of the page, not just the title, but there's probably a call for that, too... I'll have to go look.

    Thanks again!

  7. nudeweb
    Posted 2 years ago #

    Could you post the full fix for this please I have the do_shortcode filter in my functions.php file but don't quite understand where / how the passing post_type='page' too should be implemented. Thanks

  8. Joelle
    Posted 2 years ago #

    Hi nudeweb,

    [display-posts id="648" post_type="page" include_excerpt="true" wrapper="div"]

    This is how I used it. I hope that helps!

  9. josephorr
    Posted 2 years ago #

    Hello, I'm trying to display posts in a 1/3 column on the homepage using the JetPack widget. The category i'm wanting to display is the "Home" category and i'm using the following code in the column:

    [display-posts id="home" include_excerpt="true" image_size="thumbnail" wrapper="div"]

    I've followed the instructions here: http://en.support.wordpress.com/display-posts-shortcode/ but still cannot get anything to work :(

    The test server is http://www.josephorrandassociates.com/ and the column is the middle column.

    Any help would be great and much appreciated!

  10. josephorr
    Posted 2 years ago #

    Sorry, the test server is http://www.josephorrandassociates.info

    The shortcode i've tried to use is:

    [display-posts id="home" include_excerpt="true" image_size="thumbnail" wrapper="div"]

    and i've also tried:

    [display-posts category="home" include_excerpt="true" image_size="thumbnail" wrapper="div"]

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Display Posts Shortcode
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic