WordPress.org

Ready to get started?Download WordPress

Forums

Categories Images
[resolved] How to use categories images in below loop ... (4 posts)

  1. anvy
    Member
    Posted 1 year ago #

    Hello,

    I'm trying to add categories images in below code .. how to get the thumbnail using below code.

    <?php
    $counter = 0;
    $max = 6;
    $taxonomy = array('directors', 'producers', 'cinematographers', 'singers', 'writers', 'music_directors');
    $terms = get_terms($taxonomy);
    shuffle ($terms);
    //echo 'shuffled';
    if ($terms) {
    	foreach($terms as $term) {
    		$counter++;
    		if ($counter <= $max) {
    	  	echo '<p><a href="' . get_category_link( $term->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $term->name ) . '" ' . '>' . $term->name.'</a></p> ';
    	 	}
    	}
    }
    ?>

    Please solve my problem. And also your website is not working ..

    thanks :) it's a good plugin :)

    http://wordpress.org/extend/plugins/categories-images/

  2. Muhammad
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks,
    1st so sorry, yes my website was down, put now it works great.
    you can now check the full documentation and you will find more than one example, you can use any of them to get the category thumb.

    or simply you can use this line of code :)
    <img src="<?php echo z_taxonomy_image_url($term->term_id); ?>" />

  3. anvy
    Member
    Posted 1 year ago #

    Hello,

    thanks for the help. But can you please post the full code integrating yours in the loop above ?

    For me, it's not working .. :(

    thanks in advance.

  4. anvy
    Member
    Posted 1 year ago #

    When i've tried it's giving me below url as image url :

    <?php%20echo%20z_taxonomy_image_url($term->term_id);%20?>

    can you please help me out.

    thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic