WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Joelle
    Member
    Posted 1 year 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!

    http://wordpress.org/extend/plugins/display-posts-shortcode/

  2. Daniel Bachhuber
    Hand Built
    Posted 1 year 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
    Member
    Plugin Author

    Posted 1 year 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
    Member
    Posted 1 year 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 1 year ago #

    Have you tried passing post_type='page' too?

  6. Joelle
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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

About this Topic