How to Display Multiple Category Badges in Newspaper Theme’s Flex Blocks

Facebook
Twitter
LinkedIn

If you’re using the Newspaper theme by tagDiv, you may have encountered a frustrating limitation: while WordPress allows you to assign multiple categories to a post, the theme’s popular Flex Blocks only display one category badge per article.

This creates a problem when you need to visually highlight specific content types—like premium articles, breaking news, featured posts, or exclusive content—while still showing the post’s primary topic category.

Fortunately, the Newspaper theme developers included WordPress filter hooks specifically for this type of customization. The td_composer_module_exclusive_class filter allows us to add custom CSS classes to module wrappers without touching core theme files.

By combining this official hook with CSS pseudo-elements, we can display additional category badges while keeping the solution update-safe and maintainable.

Step 1: Add PHP Code

<?php

/**
 * Add custom class to posts in a specific category
 * This allows us to style them differently with CSS
 */
add_filter('td_composer_module_exclusive_class', 'add_special_category_class', 10, 2);
function add_special_category_class($additional_classes_array, $post) {
	// Replace 123 with your category ID
	$special_category_id = 123;

	// Check if post has the special category
	if (has_category($special_category_id, $post)) {
		$additional_classes_array[] = 'has-special-category';
	}

	return $additional_classes_array;
}

Important: Replace 123 with your actual category ID.

Step 2: Add CSS Styling

Add this CSS to your child theme’s style.css file, Live CSS or go to Newspaper > Theme Panel > Custom CSS:

/* Display additional category badge next to the primary category */
.has-special-category .td-post-category::after {
    content: 'PREMIUM';  /* Change this text to whatever you want */
    display: inline-block;
    margin-left: 8px;
    padding: 4px 10px;
    background-color: #f39c12; /* Orange/gold color */
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 2px;
    letter-spacing: 0.5px;
}

/* Smooth hover effect */
.has-special-category .td-post-category::after {
    transition: opacity 0.3s ease;
}

.has-special-category .td-post-category:hover::after {
    opacity: 0.85;
}

That’s It!

The additional badge will now automatically appear next to the primary category badge on all posts that belong to your specified category. No need to modify individual posts or blocks.

Matt Pramschufer is a seasoned technology expert and co-founder of E-Moxie, where he specializes in transforming visionary ideas and business goals into thriving online ventures. With over two decades of experience in website design, development, and custom application creation, Matt understands that success requires more than just a visually appealing website or a well-built app. He combines proven methodologies with the latest internet technologies to deliver digital solutions that not only look great but also drive measurable growth.