How to display tag-slug as a class of tr in wordpress? -


i use following code take tags entries class of tags. how edit code, display tags slug, not full name (i have 1 tag in posts). need have f.e. not first tag first-tag.

 <?php        // query       query_posts( array ( 'category_name' => 'best-offer', 'posts_per_page' => -1 ) );        // loop      while ( have_posts() ) : the_post(); ?>      <tr class="<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags $tag) { echo $tag->name . '';  } } ?>"> 

try using $tag->slug, instead of using $tag->name, per http://codex.wordpress.org/function_reference/get_the_tags#member_variables


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -