The the7 theme allows you to control archive layout by selecting a page in Theme options > Archive. The selected page must have any page builder Blog module with required configuration. Please refer to the documentation for more details. However, there is no option if you want to assign different archive templates for categories. Let’s say, News archive want a list layout and Event archive to want to display in masonry grid. This can be done using the filter the7_archive_page_template_id
.
1 2 3 4 5 6 7 8 9 10 11 12 | add_filter('the7_archive_page_template_id', 'archive_template_for_categories',10, 1); function archive_template_for_categories( $page_id ) { if( is_category( '18' ) ) { $page_id = 2; } if ( is_category( '19' ) ) { $page_id = 196; } return $page_id; } |
Please remember to replace category ID ( #18, #19 ) and page ID ( #2, #196 ) with yours. Using this approach you can also apply a different template for a year or month archive. Just use the appropriate conditional tag. Please read about Conditional tags in the WordPress Codex.