Snippets: 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' );

Snippet Type: PHP

Posted Under: Blog

All PHP snippets should be added via a child theme's functions.php file.