0

I am trying to create a child theme where I have created a custom post type i.e "art". I want to display all CPT posts to the homepage with pagination and the regular post to the post page.

Currently, I set Your latest posts reading settings and add an action that will show my all custom post type at home page.

add_action( 'pre_get_posts', 'add_cpt_to_homepage' );

function add_cpt_to_homepage( $query ) {
    if ( is_home() && $query->is_main_query() )
        $query->set( 'post_type', array( 'art' ) );
    return $query;
}

But my question is, is there any way to show my regular post on a different page?

1 Answer 1

0

Yes, there is a way to show your regular posts on a different page.

  1. Create a new page template
  2. Include a new WP_Query using post as the post-type. Example
  3. On the backend, create the page you want to use to display your posts
  4. In the options, select your new page template for the page
  5. Your posts should appear on the new page
1
  • 1
    Thank you. Have to try Jul 14, 2021 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.