You can use the title parameter in the shortcode to add a title above the listing of posts. But what if you want that title to dynamically include the post count? We’ll use the shortcode_atts_display-posts filter to modify the default parameters for the shortcode. If the shortcode does not have a title specified, we’ll give […]
Author: Bill Erickson
Bill Erickson is a freelance WordPress developer and a contributor to the Genesis framework. For the past 14 years he has worked with attorneys, publishers, corporations, and non-profits, building custom websites tailored to their needs and goals.
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 the current search results by Bill EricksonDisplay 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 the current post
If you would like to display the title of the current post or page, you can add the following code to add support for this shortcode:
FacetWP Support
FacetWP is an advanced filtering plugin for WordPress. It lets you build smart filters based on attributes of your content (categories, tags, metadata, publish date…). By default it applies only to the main query on the page, but it can also be applied to custom queries (more information). The code below will let you use […]
Using Health Check plugin to find theme and plugin conflicts
If you aren’t getting the results you expect from Display Posts, it could be due to another plugin or your theme modifying the query. The best way to troubleshoot these issues is with the Health Check plugin. Health Check lets you disable all plugins and change your theme for your user only. This means you […]
Display connected content using Posts to Posts plugin
The Posts to Posts plugin lets you to make connections between content types on your site. You could create a posts_to_pages connection for connecting relevant news articles to a specific page. For further reading, see the Posts to Posts documentation and my tutorial on Manually Curated Related Posts. With the code snippet below, you can […]
Meta Queries
You can query for posts based on their metadata using a Meta Query. For instance, WordPress stores the featured image using the _thumbnail_id meta key. To display the most recent posts that have a featured image, use: You can also sort resorts by meta keys. See the tutorial on displaying popular posts by share count […]
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 […]