Skip to content

Instantly share code, notes, and snippets.

@patilvikasj
Last active October 16, 2019 15:28
Show Gist options
  • Select an option

  • Save patilvikasj/42f3d9d5ac5ebe1dd065e98161fb10cc to your computer and use it in GitHub Desktop.

Select an option

Save patilvikasj/42f3d9d5ac5ebe1dd065e98161fb10cc to your computer and use it in GitHub Desktop.
This is custom snippet to overwrite blog template for category archive page.
<?php // Do not include this line in your functions.php file.
add_filter( 'astra_blog_template_name', function( $name ) {
// Replace `block` with your category slug.
if( is_category( 'block' ) ) {
return 'block';
}
// For category with slug "book". You need to add template file `blog-layout-book.php` file to get this work.
if( is_category( 'book' ) ) {
return 'book';
}
return $name;
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment