wordpressgenesis

Remove link around category and tags in Genesis template


I want to remove the links (a tag) in the blog template and in the single template in Genesis. I just want to show the plain category names and tags, and don't want a link to the categories.

<p class="entry-meta">    
    <span class="entry-categories">    
       <a href="domain.com/category/category-name/" rel="category tag">Categoryname</a>  
     </span> 
 </p>

So i want to remove the a tag.

I can't find how to do that in Genesis. I know of the function "genesis_post_meta" but i can only change the text and seperator.


Solution

  • I found this on http://elektroelch.net/wordpress-remove-links-from-the-category/:

    add_filter( 'the_category', 'no_links' );
          function no_links($thelist) {
            return preg_replace('#<a.*?>([^<]*)</a>#i', '$1', $thelist);
     }
    

    The function no_links() contains a regular expression which removes all anchors from the string. That’s the whole trick. At the end of your code you should remove the filter again, just in case the categories are displayed on the same page with the standard style.