1. Documentation /
  2. Filter Category Display on Magazine Template

Filter Category Display on Magazine Template

Requirements

↑ Back to top
  • Canvas version 5.7.0+

File to edit

↑ Back to top
If you would like to only show one category or a few categories on the Magazine Template you can edit the loop-magazine.php file on line 17 where it says: $args = woo_get_magazine_query_args(); $query = new WP_Query( $args );

Show only one category

↑ Back to top
To show only one category, you can change that to: $args = woo_get_magazine_query_args(); $args['category_name'] = 'uncategorized'; $query = new WP_Query( $args ); Where ‘uncategorized’ = the category name you want to use.

Exclude multiple categories

↑ Back to top
To exclude one or more categories from displaying, you can change it to: $args = woo_get_magazine_query_args(); $args['cat'] = '-1,-34'; $query = new WP_Query( $args ); Where ‘-1,-34’ tells the template not(-) to display posts from categories with the ID of ‘1’ and ’34’, respectively. For more information on Query $args please visit the WordPress Codex here: WP Query Category Parameters. Please note: We strongly recommend you create a child theme when working with customizations like this to make it easier to update your theme in the future and keep track of the changes you have made. Please see our tutorial on best practices when creating a child theme here.