Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi lulupont, I used the author’s loop taxonomy example, but subbed in wp_get_post_terms to grab only the tags for that post:

    <ul>
     <?php foreach (wp_get_post_terms($post->ID, 'post_tag') as $cat) : ?>
     <li>
         <?php if (function_exists('z_taxonomy_image_url')) { ?>
            <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
         <?php } ?>
         <?php echo $cat->name; ?>
     </li>
     <?php endforeach; ?>
    </ul>

    Documentation and args can be found here: http://codex.wordpress.org/Function_Reference/wp_get_post_terms

    Thread Starter lulupont

    (@lulupont)

    thanks so much for your response, Tegid.

    I tryed your code, but it is still not working for me. nothing shows up 🙁

    also, i dont nedd the tags for a post, it is a page that should list all post tags.

    Does anyone can help me out ? 🙂 i am lost

    I believe the function you’re looking for is ‘get_tags’, which will spit out all tags no matter what page you’re on. Try subbing it in and assigning it to the $cat variable, and you won’t have to change anything else:

    <ul>
     <?php foreach (get_tags() as $cat) : ?>
     <li>
         <?php if (function_exists('z_taxonomy_image_url')) { ?>
            <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" />
         <?php } ?>
         <?php echo $cat->name; ?>
     </li>
     <?php endforeach; ?>
    </ul>

    Check http://codex.wordpress.org/Function_Reference/get_tags for a list of args to change the order, exclude certain tags, etc. Good luck!

    Thread Starter lulupont

    (@lulupont)

    OMG that did it!!!!!!!!!!!!!

    thanks so much for your help, very much appreciated <3

    Thread Starter lulupont

    (@lulupont)

    sorry, i will botter you once again.

    i have my category list and my tag list with images. now i need both the images and the titles to be linkeable.

    in the category list i have this code :

    <a href="<?php echo get_category_link($cat->term_id); ?>"><?php echo $cat->cat_name; ?>
    <img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" ></a>

    and i need a similar code for the tag list… can you help me out?

    Plugin Author Muhammad

    (@elzahlan)

    Hey,

    Thanks Tegid for help 🙂 and sorry for my late reply.
    lulupont, about what you asked for you use this:

    <a href="<?php echo get_tag_link($cat->term_id); ?>"><?php echo $cat->name; ?>
    <img src="<?php echo z_taxonomy_image_url($cat->term_id'); ?>" ></a>

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘how to do it with tags’ is closed to new replies.