0

On Wordpress default, when we click one of category, for example the category name is "Bags" then we see list of all posts in "Bags".

How to remove category link to "Bags" in "Bags" under each post?

Another word:

How to remove category link "Clothes" in "Clothes"?

  • If a post has 3 categories then it will show 2 categories. The removed one is that being viewed one.
  • The removed category only when it is being viewed.

I tried the CSS

a:visited { display:none; }

from here but my problem is not about visited link.

Community
  • 1
  • 1
  • Check the link itself and see if there are any unique classes/ids set. If so set that class/id to display:none; – Howli Jan 05 '15 at 16:46
  • the best way would probably be to check where the category names get generated and add a filter for it. – RST Jan 05 '15 at 16:48
  • How to exclude single_cat_title() from categories that collected by get_the_category(); ? – hendart Jan 07 '15 at 08:41

1 Answers1

0

[Solved]

I combine from here and here

$category = get_category( get_query_var( 'cat' ) );
$cat_id = $category->cat_ID;
foreach((get_the_category()) as $cat) {
if (!($cat->cat_ID==$cat_id)) echo '<a href="' . get_bloginfo('url') . '/category/' . $cat->category_nicename . '/">'. $cat->cat_name . '</a>' . ', ';
}

Thanks @RST @Howli for the clues.

Community
  • 1
  • 1