Exclude a Specific Category from Bylines

Applies to Version(s): Thesis 1

If you’ve got a special category which you assign to posts only for a specific purpose (such as a category named “Featured” which you use to display certain posts in the Thesis Feature Box), you may not want this category to also show up in the Byline area when those posts appear elsewhere on the site. With some custom PHP code, you can keep the category from showing up in your Bylines.

First, go to Thesis Design Options > Display Options > Bylines, and uncheck “Show post categories”.

Then, place the following code in your custom_functions.php file, replacing Featured with the proper name of the category you wish to exclude from your Bylines:

function custom_cat_byline() {
	global $post;
	$categories = get_the_category();
	$count = count($categories);
	echo '<p class="headline_meta">';	
	foreach ($categories as $category) {
		if ($category->name=='Featured') { $count -= 1; continue; }
		$in = $count;
		$cat_name = $category->name;
		$category_id = get_cat_ID($cat_name);
		$category_link = get_category_link($category_id);
		$result .= '<a href="' . $category_link . '" title="View all posts in ' . $cat_name . '">' . $cat_name . '</a>';
		$count -= 1; if ($count >=1) $result .= ', ';
	echo ($in == 0) ? '' : 'in <span>';
	echo $result; 
	echo "</span></p>\n";