Here’s how to do it!
add_action( 'pre_get_posts', 'my_query_mods' );
function my_query_mods( $query ){
if( is_admin() ) return;
if( is_main_query() && is_home() )
$query->set( 'post_type', 'texture' );
}
Code monkey get up, get coffee…
Here’s how to do it!
add_action( 'pre_get_posts', 'my_query_mods' );
function my_query_mods( $query ){
if( is_admin() ) return;
if( is_main_query() && is_home() )
$query->set( 'post_type', 'texture' );
}
Comments
3 responses to “Displaying Custom Post Type Archive on Your WordPress Homepage”
Now a more difficult task: same as above, but *STILL* have the regular posts archive (i.e. what *USED* to be the front page) available at some URL.
Just set the homepage to a static post and don’t select a posts page?
Oh, sorry, I misread what you were suggesting.
What you’d want to do in that case is set a post as your homepage, then if that post is the current page, redo the wp query to pull the custom post type from scratch.
I think.
Any number of ways to do it, that’s just the way that makes the most sense to me.