The [post] shortcode can be used to display a secondary loop of posts anywhere using WP_Query.

Posts shortcode arguments
Typeitems grid cards
Itemscompact very compact divided relaxed very relaxed
Griddivided vertically divided celled internally celled relaxed very relaxed
Cardsraised stackable doubling centered fluid red green blue ...
queryWordPress query string or keyword (Available keywords: related).
templateCustom template name. Template file must reside in the (child) theme's templates directory and be prefixed with loop- (ex. templates/loop-list).
excerptCustom excerpt length (number of words). Set to 0 to disable excerpts. (Default: 55)
thumbnailCustom thumbnail image size (none|thumbnail|small|medium|large|full). (Default: medium)
headerPosts header size (tiny|small|medium|large|huge). (Default: small)
metaInfo displayed below post title. (date_author|timeago_author|date|timeago|author|none)
tagsSet to false to disable tags (categories, tags and sticky post indicator).
read_moreSet to false to disable the "Read more" link.
paginationSet to true to enable pagination.
pagination_alignmentPagination alignment (left|center|right).
pagination_menuAdditional classes for the pagination menu.
nextPagination next posts link text (default: "Older posts").
prevPagination previous posts link text (default: "Newer posts").
countSpecify post count when query is a keyword (default: 4).
header_textHeader text to display above posts (only displayed if there are posts).
header_classesClasses for the header.
content_beforeContent before the posts (only displayed if there are posts).
content_afterContent after the posts (only displayed if there are posts).
[posts items query="posts_per_page=3&ignore_sticky_posts=1"]
[posts divided items query="posts_per_page=3&ignore_sticky_posts=1"]
[posts very relaxed items query="posts_per_page=3&ignore_sticky_posts=1"]
[posts grid query="posts_per_page=3&ignore_sticky_posts=1"]
[posts divided two column grid query="posts_per_page=4&ignore_sticky_posts=1"]
[posts celled two column grid query="posts_per_page=6&ignore_sticky_posts=1"]
Internally celled grid
[posts internally celled two column grid query="posts_per_page=6&ignore_sticky_posts=1&meta_key=_thumbnail_id"]
[posts cards query="posts_per_page=3&ignore_sticky_posts=1&meta_key=_thumbnail_id"]
[posts four stackable cards query="posts_per_page=4&ignore_sticky_posts=1"]
[posts divided items query="posts_per_page=3&ignore_sticky_posts=1" pagination="true"]
[posts two column grid
	next="Older entries"
	prev="Newer entries"
	pagination_menu="tiny secondary"
[posts one column vertically divided grid
	next="Older post"
	prev="Newer post"
The loop-content template is designed to show posts with content inside grid loops.
[posts items query="posts_per_page=3&ignore_sticky_posts=1" header="huge"]
No thumbnails
[posts three column grid query="posts_per_page=3&ignore_sticky_posts=1&meta_key=_thumbnail_id" excerpt="20" thumbnail="none"]
[posts three column grid query="posts_per_page=3&ignore_sticky_posts=1&meta_key=_thumbnail_id" excerpt="0"]
No meta
[posts three column grid query="posts_per_page=3&ignore_sticky_posts=1&meta_key=_thumbnail_id" excerpt="20" meta="false"]
No tags
[posts three column grid query="posts_per_page=3&ignore_sticky_posts=1&meta_key=_thumbnail_id" excerpt="20" tags="false"]
[posts three column grid query="posts_per_page=3&ignore_sticky_posts=1&meta_key=_thumbnail_id" excerpt="20" read_more="false"]
More posts
[subheader dividing]More posts[/subheader]
[posts compact marginless items query="posts_per_page=5&ignore_sticky_posts=1" header="tiny" excerpt="0" thumbnail="none" meta="true" tags="false" read_more="false"]
[posts query="related" count="5"]
Using the "related" keyword as query will fetch related posts.
You can use custom WP_Query arguments programmatically by using the csc_posts_query filter. Argument 2 of that filter will contain the shortcode's arguments which can be used to identify which instance of the shortcode it is.
[posts id="custom"]
add_filter('csc_posts_query', function($query, $args) {
	if(isset($args['id']) && $args['id'] === 'custom') {
		return [
			'category__in' => [2, 6],
			'posts_per_page' => 3,
	return $query;
}, 10, 2);
[posts items query="posts_per_page=3&ignore_sticky_posts=1" header_text="Header shown when there are posts" header_classes="large dividing"]
[posts items query="posts_per_page=3&cat=123123" header_text="Header not shown because there are no posts"]
Header can be prepended with the header_text argument for only when there are results.
[posts items query="posts_per_page=3&ignore_sticky_posts=1" content_before="<div class='ui primary segment'>" content_after="</div>"]
[posts items query="posts_per_page=3&cat=123123" content_before="<div class='ui primary segment'>" content_after="</div>"]
You can specify before and after content to wrap the posts in something. The wrapper elements won't be displayed when there are no posts.
That way there won't be an empty container when there are no related posts for example.
[posts three column internally celled stackable grid query="related" count="6" header_text="Related posts" header_classes="large dividing" content_before="<div class='ui segment'>" content_after="</div>"]
Adding this shortcode to Chap Theme -> Code -> After post content can easily display related posts for all posts.
Exit mobile version