Co-Authors Plus lets you assign multiple authors to a post. The code below integrates Co-Authors Plus with Display Posts so your post listings will include all authors. This can also be installed as a plugin: CoAuthors Plus Addon Usage Customization The following parameters can be added to the shortcode to customize the output of the […]
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.
Exclude posts already displayed
If you’re using the Display Posts Shortcode multiple times in one page, you can use this to exclude already displayed posts from new shortcode queries. This will prevent duplicate posts. If you have other, non-Display Posts queries running on the page and would like to exclude them as well, you’ll need to modify those queries […]
Add category classes
I’m using the short code but there are some categories I would like to show in one color and then other categories should show in a different color. LesTexas60 You can use the display_posts_shortcode_post_class filter to customize the classes added to each post. Here’s how to add a class for each category attached to a post:
Polylang support
If you are using Polylang or Polylang Pro to translate content on your website, you can also query by posts in a specific language. See the documentation for more information.
Display default image
The image_size parameter lets you include a thumbnail in your post listing, but it only works if the post has a featured image attached to it. The code snippet below lets you specify a default image ID to use in case a post doesn’t have a thumbnail. You can find the image ID by going […]
Display upcoming events from Sugar Event Calendar
Sugar Calendar, like most other event calendars, stores the event dates as metadata. To sort your results by the event date (meta_key is sc_event_date_time) use: That will list every event starting with the oldest to newest. If you want to list only upcoming events, we’ll need to do a meta query. This specific meta query […]
Show siblings to current page
Is there any way to show siblings of the current page? TIA! Jay Collier Yes, you can use the following shortcode: That will list all the subpages with the same parent as the current page