开发者 |
billerickson
cultivatewp |
---|---|
更新时间 | 2024年6月3日 21:50 |
PHP版本: | 3.0 及以上 |
WordPress版本: | 6.5 |
[display-posts]
Filter by Category
To only show posts within a certain category, use the category parameter:
[display-posts category="news"]
Display as Post Grid
You can create a great looking, column-based grid of posts with a bit of styling. Here's how!
List Popular Posts
You can highlight your popular content in multiple ways. If you want to feature the posts with the most comments, use:
[display-posts orderby="comment_count"]
You can also list most popular posts by social shares.
Include thumbnails, excerpts, and more
The display parameters let you control what information is displayed for each post. To include an image and summary, use:
[display-posts include_excerpt="true" image_size="thumbnail"]
You can use any image size added by WordPress (thumbnail, medium, medium_large, large) OR any custom image size added by your theme or other plugins.
Sort the list however you like
By default the listing will list the newest content first, but you can order by title, menu order, relevance, content type, metadata, and more.
List upcoming events
You can easily list upcoming events from any event calendar. Each plugin will require slightly different code.
Here are tutorials for popular event calendar plugins. If your plugin is not listed here, submit a support request and I'll add it!
Tutorials
Our tutorials cover common customization requests, and are updated often.
Full Documentation
display-posts-shortcode
to the /wp-content/plugins/
directory.[display-posts]
shortcode to a post or page.pre_display_posts_shortcode_output
filter before shortcode runs, used for transient caching, see #210display_posts_shortcode_output
filterdisplay_posts_shortcode_category_display
filter, see #185exclude
for excluding specific post IDs, see #154
category_id
for specifying category by ID (note: only accepts a single ID), see #156include_date_modified
for displaying the date the post was last updated, see #150display_posts_shortcode_no_results
filter for displaying content if there's no posts matching current query.id
argument to specify specific post IDsdisplay_posts_shortcode_args
filter in case the arguments you want aren't already included in the shortcode. See example: http://www.billerickson.net/code/display-posts-shortcode-exclude-posts/post_parent
where you can specify a parent by ID, or you can say post_parent=current
and it will use the current page's ID.wrapper
where you can decide if the posts are an unordered list, ordered list, or div's