Skip to content

Snippet: Alter Blog Entry Elements(blocks) For Specific Categories/Tags

/**
 * Alter the blog entry blocks via filter.
 * Available Blocks: featured_media, title, meta, excerpt_content, readmore.
 */
add_filter( 'totaltheme/blog/entry_blocks', function( $blocks ) {

	// Alter for "web-design" category
	if ( is_category( 'web-design' ) ) {
		$blocks = array(
			'title',
			'featured_media',
			'excerpt_content',
		);
	}

	// Return blocks
	return $blocks;

} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top