How to allow Custom Post type to main query to filter custom post on archive/category page

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?

Project Repo: frontity-portfolio-blog

Thank you

Hi @shaponpal4 ,

Welcome to the Community!

I don’t understand why do you need add_action('pre_get_posts', 'sp_allow_custom_post_type_on_main_query');

The configuration of Custom Post Types in Frontity is documented at

There’s also the following demo available showing how this works

Hope this helps