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 […]
WordPress lets you mark posts as “sticky” so they appear at the top of listings, regardless of publish date. You can prevent sticky posts from appearing at the top of Display Posts using: This doesn’t actually exclude sticky posts, it just prevents them from appearing at the top. Display sticky posts After adding the code […]
Display Posts lets you limit posts to a certain category with the category parameter. But what if you’d like to show other posts in the current post’s category without having to type it out each time. This is especially useful in widgets and sidebars since you can add the shortcode once and it will automatically update to […]
You can use Display Posts to list upcoming events from The Events Calendar. After adding the code snippet below to your site, you can generate a list of upcoming events with:
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 […]
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.
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 […]