Custom Post Type archive as front page

Why don’t you try using a home.php file and place your desired loop/query within that file or alternatively use get_template_part to retrieve a file that contains your loop.

Can you please show us your code?

What I frequently do is structure my index.php like so,

<?php get_header(); ?>

    <?php if ( is_home() ) {

            get_template_part('home.php');

        } else {

           //run standard/default loop here

        } 
    ?>

<?php get_footer(); ?>

Then within home.php you can do literally whatever you like,

$args = array( 'posts_per_page' => 10, 'post_type' => 'custom_post_type' );
$wp_query = new WP_Query( $args ); 
while ( $wp_query->have_posts() ) : $wp_query->the_post();
 //get your title, content, tags, etc
endwhile;

With this approach you are NOT required to set a static front page within your dashboard settings under the normal Settings -> Reading -> Front page displays section.

Note: This is not the only way to achieve what you want, but a reliable method without having to resort to using any filters, if you’re not comfortable with using them or in the event you’re having trouble (of course saying this without seeing your code so far).

Leave a Comment