Show the latest posts on any page
wp-query="'post_type'=>'post','posts_per_page'=>3" News on the home page, three articles under a post, upcoming events: the block fills itself from WordPress, and the client only publishes posts.
Where it goes
On the block that holds the cards. The value is the WordPress query settings as pairs: 'post_type'=>'post','posts_per_page'=>3. The query-string form post_type=post&posts_per_page=3 works too.
The first card is the pattern: put wp="post-title", wp="post-image", wp="post-date" and other post values inside it. The other cards in the markup are dropped.
A block with wp="no-results" right after it is shown when there are no posts.
Example: news on the home page
<div class="news" wp-query="'post_type'=>'post','posts_per_page'=>3">
<article class="news-card">
<img src="images/news.jpg" alt="" wp="post-image">
<h3><a href="#" wp="post-title-link">New autumn menu</a></h3>
<p wp="post-date">October 1</p>
</article>
</div>
<div class="news-empty" wp="no-results">No news yet</div>- New autumn menu
- Filter of the day is back
- Open on Sundays
- Pastry week
What matters
- Settings in the WordPress format:
post_type(post, product, your own type),posts_per_page,category_name,orderby. - A query the client should change without the markup: create it in ThemeForge → Queries and refer to it by name,
wp-query="[latest-news]". - Page numbers under this list:
wp-paginate-queryon a block after it, see wp-paginate.
Common mistakes
The build log is the “Logs” tab of your project on themeforge.pro; the free markup check shows the same notes.
<div wp-query="post|3">…</div>A shorthand of your own: WordPress does not understand it and shows the latest posts. The build log names the value.
<div wp-query="'post_type'=>'post','posts_per_page'=>3">…</div>Pairs in the WordPress format.
Alternative spelling
wp_query works the same: the build gives an identical theme.