Note: This post is about my efforts to learn and understand how the WordPress Categories Query block works in the Classic vs block themes. It’s still a work in progress, so I’ll be updating it regularly.
Recently, one of my close friends, who volunteers for a non-profit organization, reached out for assistance with a small issue. He asked me to create a page on their WordPress site that would display posts from specific categories. The desired layout was straightforward: a brief introductory statement followed by a list of posts from selected categories.
The website
The website runs on WordPress and uses the upsale Classic theme, which is tailored to manage membership and related plugins. It’s powered by a variety of plugins to handle different functions, such as design creation, form building, event management, membership handling, payment gateways, and other critical tools to keep the organization running smoothly.
The main goal was to display posts from chosen categories, such as “Our Story” and “Events,” on a dedicated page of of the site. This page would also be added to the top navigation menu. The page layout would consist of a title, a short description, and a list of posts, filtered by a custom query function that pulls content from the selected categories.
In this post, I’ll walk through how I achieved this setup on demo sites, using both Classic themes and newer Block themes.
Classic themes
To display posts from specific categories on a page in a Classic WordPress theme, use a combination of a custom page template and WP_Query. Here’s a step-by-step solution:
Step 1: Create content files as posts and assign categories

Step 2: Create a Custom Page Template
Note: To customize the template or modify the theme and styling, you’ll need access to the server files. To maintain these changes during theme updates, it’s recommended to add any custom files or code to a child theme.
In this proof-of-concept example, the modifications are directly added into the theme’s template folder.
Add this PHP code to your theme as page-category-posts.php:
/*
Template Name: Category Posts Page
*/
get_header(); ?>
<div class="category-posts-page">
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h1><?php the_title(); ?></h1>
<div class="page-content">
<?php the_content(); ?>
</div>
<?php endwhile; endif; ?>
<?php
// Define categories to display (modify slugs as needed)
$categories = array('our-story', 'event');
foreach ($categories as $category_slug) :
$category = get_category_by_slug($category_slug);
if ($category) :
$args = array(
'post_type' => 'post',
'posts_per_page' => 5,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $category_slug,
),
),
);
$query = new WP_Query($args);
if ($query->have_posts()) : ?>
<section class="category-section">
<h2><?php echo esc_html($category->name); ?></h2>
<ul>
<?php while ($query->have_posts()) : $query->the_post(); ?>
<li>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
<p><?php echo get_the_excerpt(); ?></p>
</li>
<?php endwhile; ?>
</ul>
</section>
<?php endif;
wp_reset_postdata();
endif;
endforeach; ?>
</div>
<?php get_footer(); ?>
Step 3: Assign the Template to Your Page
- Go to Pages > Add New in WordPress.
- Create a page with your title and description.
- In the right sidebar under Page Attributes, select the Category Posts Page template.

Screenshot showing - Publish the page (see below).

The published page displays both the page content (item 3, above) and the lists of posts under the “Our story” and “Events” categories. As suggested below, the page needs CSS style customization, as well as other suggestions in Step 3.
Step 4: Customize the Code (Optional)
- Change categories: Modify the
$categories = array('our-story', 'event');line to use your category slugs. - Styling: Add CSS to
.category-sectionin your theme’sstyle.css. - Pagination: Add
'posts_per_page' => 5and pagination logic if needed
Note: To add the category page template file to the theme files, access to the host server account is necessary. In contrast, block themes allow you to create template files without access to the files.
Block themes
Customizing styles and adding or modifying files in block themes is simpler than in classic themes and doesn’t require access to remote server files. However, to ensure customizations are preserved, any modified files and code snippets should be added to a child theme, just as with classic themes.
Note: The Custom Block Theme plugin allows the creation of child themes without needing access to the remote server file directory.
To display posts from selected categories (e.g., ‘Our Story,’ ‘Events‘) in block-based themes while maintaining the same structure (Title → Description → Filtered Posts), use the following methods:
Step 1: Create Query Loop using Block Editor
- Create a new page and add a Query Loop block (found under “Design” in the block inserter).
- Configure the Query Loop, as shown below:

- Customize the layout with blocks like Post Title, Featured Image, and Excerpt inside the Query Loop (optional).
- Add manual content (title/description) above the Query Loop block.
- Publish the page.

Alternative method: Category Templates (Block Theme Feature)
- Create a custom category template via Appearance → Editor → Templates → Add New → Category.
- Add a Query Loop block and configure it to show posts from specific categories using the method above.
- Assign the template to categories like “Our Story” or “Event” via the template settings.
Note: This method displays posts when visiting category archives (e.g., /category/our-story), not on a standalone page.
Key Differences from Classic Themes
- No PHP templates: Block themes rely on the Site Editor and block configurations instead of
WP_Queryin PHP files. - Template hierarchy: Category-specific designs now use block-based templates (e.g.,
category-our-story.html) instead ofcategory.php. - Dynamic filtering: The Query Loop block replaces custom PHP loops, offering GUI-based filtering.
- No access to remote server files: Any file addition, modification, or style customization can be done without access to the back-end server files.
- No coding skill required: Even with limited coding skills, you can make desired customizations to the block themes once you have a basic understanding of their block themes.
Wrapping Up
This brief learning note walks you through displaying posts from selected categories in both classic and block themes. It also highlights the key differences between these theme types and explains how, in block themes, the task can be accomplished with minimal coding or language skills directly from the front end.
Related Resources
- Exploring category templates with block themes | Learn WordPress
- How to Use the WordPress Categories Block | Elegant Themes
- Template for posts of category in block theme? | Stock Exchange
- Categories List Block | WordPress.com
- How to Display Recent Posts From a Specific Category in WordPress | WP Beginners
- Categories Block | WordPress Documentation
- How to Display the Categories, Tags for a WordPress Post | TaxoPress

