skip to Main Content

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,
 *
 * @return array
 */
function my_wpex_blog_entry_layout_blocks( $blocks ) {

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

	// Return blocks
	return $blocks;

}
add_filter( 'wpex_blog_entry_layout_blocks', 'my_wpex_blog_entry_layout_blocks' );
All PHP snippets should be added via child theme's functions.php file or via a plugin (we recommend Code Snippets)
Back To Top