dlovas
9/7/2017 - 8:28 PM

WordPress archive-custom.php

WordPress archive-custom.php

/* When setting up the CPT you must have has_archive set to true as noted below. 
And the archive-custom.php must be exactly how the post type is named. */

add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'deals',
        array(
            'labels' => array(
                'name' => __( 'Deals' ),
                'singular_name' => __( 'Deal' )
            ),
        'public' => true,
        'has_archive' => true,
        )
    );
}
<?php
get_header();
if(have_posts()) : while(have_posts()) : the_post();
    the_title();
    echo '<div class="entry-content">';
    the_content();
    echo '</div>';
endwhile; endif;
get_footer();
?>
SRC:
https://code.tutsplus.com/articles/the-rewrite-api-the-basics--wp-25474

This will automatically filter and only show a loop of this particular post type.