Display Posts Shortcode
[resolved] "Wrapper" option not available (6 posts)

  1. FaffeF
    Posted 4 years ago #

    The "wrapper" option is not available in 1.6, as stated in the documentation.

    Also, it would be nice to be able to display the list of posts as a comma-separated list of linked titles, to save some screen-estate.


  2. Bill Erickson
    Plugin Author

    Posted 4 years ago #

    Are you sure you're using it correctly?

    [display-posts] or [display-posts wrapper="ul"] displays an unordered list.

    [display-posts wrapper="ol"] displays an ordered list

    [display-posts wrapper="div"] displays nested divs

    I've just tested and confirmed with the current version of the plugin.

    For other display options, like a comma-separated list, you'll need to use the filters. There's one filter for the opening wrapper (so set that to <p>), one wrapper for the closing wrapper (so set that to </p>), and one for the markup of each individual post. Here's an example ( https://gist.github.com/1342863 ). For the individual posts, I wrapped each one in a span and only included the title. I've left all the parameters of the filter in place in case you want to add other content to the list.

  3. FaffeF
    Posted 4 years ago #

    Pretty sure. A search of the source show no hit on 'wrapper', specifically there no mention of it in the shortcode_atts array. It says 1.6 at the top.

    Thanks for the filter!

  4. FaffeF
    Posted 4 years ago #

    So, I updated manually. Still 1.6, but now the wrapper option is there.

  5. FaffeF
    Posted 4 years ago #

    And, by the way, it's unbelievably easy to just paste the filter in to the functions.php of a child theme, that way no modifications are lost on either wordpress, plugin or theme upgrade!

  6. Bill Erickson
    Plugin Author

    Posted 4 years ago #

    Here's the actual plugin code: http://plugins.svn.wordpress.org/display-posts-shortcode/trunk/display-posts-shortcode.php

    If you search, you'll see 'wrapper' is mentioned 18 times. If you try the three shortcodes listed above you'll get the desired result.

    Yes, it is easy to put the filter in a child theme so it isn't lost on update. That's the purpose of the filters :)

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