The Display Posts plugin lets you create a list of posts using a wide range of query parameters. It will display the result as a bulleted list by default. The code below will turn it into a select dropdown, and selecting a post will take you directly to that post. After adding the code to […]
Filter: display_posts_shortcode_output
The output filter lets you add, edit, remove, and re-order the elements that make up each post listing. More information.
Display image from post content if no featured image
The image_size parameter allows you to include an image in your Display Posts listing of any size you like. Here’s the description from the documentation: image_sizeSpecify an image size for displaying the featured image, if the post has one. The image_size can be set to thumbnail, medium, large (all controlled from Settings > Media), or […]
Display meta value in output
Display Posts includes many display parameters for customizing what is displayed in the post listing output. You can include things like the post title, image, excerpt, content, date, author, categories, and more. You can use the output filter to both modify existing pieces of the output (ex: default image) and add your own custom pieces […]
Display author avatar
You can display the author name in the listings using Display posts as a select dropdown by Bill EricksonRemove “by” when displaying author name by Bill EricksonDisplay specific posts by Bill EricksonReversed Ordered List by Bill EricksonDisplay image from post content if no featured image by Bill EricksonAdd extra text after title by Bill EricksonUse […]
Display results as a table
On Dog Food Advisor we use Display Posts to dynamically list the best dog foods based on different criteria. In some areas we wanted to display these results as a table: The code below updates the listing to a table when the layout=”editors-choice” parameter is set. Shortcode Code
Use headings for post listing
Display Posts has a few simple layouts built-in using the wrapper parameter: wrapper=”ul” creates a bulleted list (default display) wrapper=”ol” creates a numbered list wrapper=”div” creates a listing with no list But none of these options include headings, and they combine everything into a single line of text. Heading Block layout The code below adds […]
Include comment count and link to comments
Display Posts includes many Display Parameters for customizing what is shown for each post in the list. It does not include an option for listing the comment count, but you can add one yourself using the Output Filter. Once the code below has been added to your site, you can include the comments link like […]
Open links in a new window
The links in Display Posts all open in the current window. We can use the output filter to modify this, making all links open in a new window:
Add “delete post” link if user has permission to edit content
If a user is logged in and has permission to edit/delete an article, this snippet will add a “Delete Post” link at the end of the listing for them to do so.
Use template parts to match your theme’s styling
Display Posts lets you easily display posts based on any criteria you choose without any coding. It can be difficult to match your theme’s design for post summaries using just the shortcode and CSS. That’s where template parts come in. Styling belongs in a theme Your theme already contains the markup and styling for displaying posts. […]