How to add multiple custom post types under one page?

17 views Asked by At

enter image description here

I'd like to add multiple custom post types under the setting: Posts page: then display 2 post pages.

I want to show all the resources posts and jobs posts which are both custom post types?

1

There are 1 answers

0
Johannes On

You can use the WP_Query class for a custom loop in a PHP template and list the desired custom post types in the arguments array like this:

$args = array(
  'post_type' => array( 'resources', 'jobs' )
);
$query = new WP_Query( $args );

The full documentation for it can be found here: https://developer.wordpress.org/reference/classes/wp_query/

Post Type parameters on this page are here: https://developer.wordpress.org/reference/classes/wp_query/#post-type-parameters