Tag Info

New answers tagged


You should rename your file archive-event.php instead of template-event.php as per the WordPress Theme Hierarchy. The template-event.php (template-customposttypename.php) file used for display the content of single events as the single.php working to display the content of post content. You can use your above code by using any page template also. I hope it ...


Something like this should work from your functions file as long as you use the correct conditional tag for your CPT archive: function exclude_single_post_cpt($query) { if (is_post_type_archive('event') && $query->is_main_query() && !is_admin() ) { $query->set('post__not_in', array(1646)); } } add_action('pre_get_posts', ...

Top 50 recent answers are included