• Resolved madeleod

    (@madeleod)


    Hi,
    I have been trying to style my tags.
    Here is my code

    <?php $terms = get_terms( 'portfolio_tag' ); ?>
    <?php $tags = wp_get_post_terms($post->ID, 'portfolio_tag');?>

    Here I retrieve $terms, the list of my tags for portfolio and $tags, the tags for the post.
    Now, I wanted to display the whole list and put a color to the ones of the post.

    <?php foreach ($terms as $term ) : ?>
    <li><a href="<?php bloginfo('url'); ?>/portfolio-tag/<?php echo $term->slug ; ?>"><span><?php echo $term->name; ?></span></a></li>
    <?php endforeach; ?>

    Within this list, I would like to indicate the ones which are displaying into the post
    I know that I have to put the result of my query into the
    <li> with <li class="<?php echo $result; ?>
    But I am unable to create my query, Should I have to add an other foreach? and asking if $term->term_id = $tag->term_id then echo “yes”?
    Thanks for your help
    Mad

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Styling tags of custom posts’ is closed to new replies.