Frontpage CPT Template

Hi.

I have customized my archive and single page templates for use in the loop. I’d found some code allowing me to get these cpt’s to show on the homepage, but it killed Xtheme’s blog functionality at the same time. I’m looking for the proper is_blog example I suppose to see how to have it only display the cpt’ version on the home page and not have it effect the blog, or have the blog be separated from the CPT index on the home page…

This allows the CPT to show

add_action( 'pre_get_posts', 'wpse_242473_add_post_type_to_home' );

function wpse_242473_add_post_type_to_home( $query ) {

    if( $query->is_main_query() && $query->is_home() ) {
        $query->set( 'post_type', array( 'properties') );
    }
}

It actually might be a theme template file I have to create for this. I’m still trying to figure it out.

Thanks
B

Ok, it looks like I can’t have a blog and an custom archive page as the homepage at the same time. The function above just makes the blog show the CPT, which would be fine if this was the homepage. But I need the blog to still show post_type of “posts” still while the homepage displays the custom archive-properties.php or even an index-homepage.php type of thing would work.

Hi There,

You can create a Blog category then assign your posts to this category.

The link should be like this: http://www.yourwebsite.com/blog.

Hope it helps :slight_smile:

So there’s no way to do have the cpt specified listing on the homepage?

This is what I’m aiming for:

/blog should be the blog
/ should be homepage with cpt based listing (like only feature posts in cpt for example)
/cpt/ should be archive.php of that cpt

Thanks
B

Hi,

It’s possible with custom development but this is outside the scope of support that we can offer.

Your best option without any custom code is to create a blog category as my colleague have suggested.

Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.