Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.
foreach((get_the_category()) as $cat) {
if (!($cat->cat_name=='Featured')) echo $cat->cat_name . ' ';
}

this is what has been recommended in the forums but its not working for me. I need to split off the echo piece like the following to show an image.

<li><img src="<?php bloginfo('template_url'); ?>/images/cats/<?php echo $category->slug ?>-icon.png"/>  <?php  echo $category->cat_name ?> </li>

any ideas?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Try this:

foreach((get_the_category()) as $cat) {
    if ($cat->cat_name != 'Featured') {
        echo '<li><img src="' . get_bloginfo('template_url') . '/images/cats/' . $category->slug . '-icon.png"/>' . $category->cat_name . '</li>';
    }
}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.