0

I'm looking for an option to show a specific Custom post type on a specific page. In a category there are 10 posts but on the homepage I just want to show for example 3 specific post types of that category. What is the best way to have control over this behavior?

Thanks

1 Answer 1

0

This way you can make a private listing

function posts_kind($query){

// page id 4173 show

if(is_page('4173')){

// category id 1 show  

$query->set('cat', 1);

return $query;
}

}

add_action('pre_get_posts','posts_kind');
1
  • Thanks, that's a nice solution for a specific template.
    – Bouke
    May 15, 2021 at 5:54

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.