To display a custom query in a single page you would need to create a new page template and assign that to a page.
- Create a file in your theme’s main folder and call it multiple-categories.php
-
Paste the following code in the file
<?php /* Template Name: Multiple Categories */ get_header(); $args = array( 'cat' => '1, 5, 9', 'posts_per_page' => -1, ); $my_posts = new WP_Query( $args ); if( $my_posts->have_posts() ){ while( $my_posts->have_posts() ){ $my_posts->the_post(); //Echo the post } } wp_reset_postdata(); get_footer();
-
Create a new page and in the template field select “Multiple categories”.
Visiting that page you should see the articles from any of those categories.
The template file and name is just an example and can be changed at will without using the default ones listed here https://developer.wordpress.org/themes/basics/template-hierarchy/
More details about the arguments for the query relative to categories can be found here:
https://codex.wordpress.org/Class_Reference/WP_Query#Category_Parameters