Displaying Custom Post Type Archive on Your WordPress Homepage

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' );

3 Replies to “Displaying Custom Post Type Archive on Your WordPress Homepage”

  1. 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.

      1. 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.

Comments are closed.