Hello,
I am using twentytwenty-theme theme package.
By default, Custom Post type is excluded from main query on archive page. So i support this on my theme
// Allow Custom Post type to main query to filter post on archive/category page
function sp_allow_custom_post_type_on_main_query($query)
{
if (!is_admin() && $query->is_main_query()) {
if ($query->is_category()) {
$query->set('post_type', array( 'post', 'project' ));
}
}
}
add_action('pre_get_posts', 'sp_allow_custom_post_type_on_main_query');
Now how i do this on my frontity twentytwenty-theme package also ?
I try this documentation also.
could you help me please?
When i hit this url it’s loaded archive page on frontity twentytwenty-theme package .
It’s filter post as well but not filter custom post type (project) post.
So how allow this filter on archive page?