Creating custom post-listing templates in twentyseventeen child theme
I’m using a child theme based on ‘Twenty Seventeen’ and have created a custom post type (‘review’).
I want to make two Pages, one which lists ‘reviews’ and the other which lists a mixture of ‘posts’ and ‘reviews’ (ordered by recency).
For the first of those I’ve made a copy of Twenty Seventeen’s
page-reviews.php, and added code like this at the start:
$args = array( 'post_type' => 'review', 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 10, ); $the_query = new WP_Query( $args );
Then, further down, replaced
If I choose to use that template for a Page then it works in that the ‘reviews’ are listed, but the layout is all messed up. There are a lot of classes in the
<body> which mess up the layout.
For example, the standard blog front page, using
index.php, has these classes in its
<body> and looks fine:
blog logged-in admin-bar hfeed has-header-image has-sidebar colors-light customize-support
While my custom page has these:
page-template page-template-page-postslist page-template-page-postslist-php page page-id-15071 logged-in admin-bar has-header-image page-two-column colors-light customize-support
How can I make a custom template that acts more like
index.php in terms of the classes it adds?