WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Images
Template Page Custom Taxonomy return ALL (2 posts)

  1. Tisha Oehmen
    Member
    Posted 2 years ago #

    I really enjoy the features that Taxonomy Images affords. After a lot of trying, I was finally able to get category images to appear on a page template with the following code:

    <?php global $taxonomy_images_plugin;
    			$cats = get_categories( 'order=desc&orderby=count&child_of=3&hide_empty=1&term_id=-708' );
    				foreach ( $cats as $c ) {
    					if ($c->count > 1){
    						$url = get_category_link( $c->term_id );
    								$img = $taxonomy_images_plugin->get_image_html( 'thumbnail', $c->term_taxonomy_id );
    							if( !empty( $img ) )
    							print '<a href="' . $url . '" title="' . '">' . $img . '</a>';
    						}
    				} ?>

    Now, I'm trying to get the same result with a custom taxonomy 'services'. I've tried all the code snippits to accomplish this that I can find -- but haven't had any luck. I am able to get wp_list_categories to return a list of the custom taxonomy with this code:

    $args = array(
    		  'taxonomy'     => 'services',
    		  'depth'     	 => '1'
    		);global $taxonomy_images_plugin;
    			$cats = wp_list_categories( $args );
    				foreach ( $cats as $c ) {
    					if ($c->count > 1){
    						$url = get_category_link( $c->term_id );
    							$img = $taxonomy_images_plugin->get_image_html( 'thumbnail', $c->term_taxonomy_id );
    						if( !empty( $img ) )
    						print '<a href="' . $url . '" title="' . '">' . $img . '</a>';
    					}
    				}

    But it won't show the images.

    Anyone have any code they've been successful in using to return a complete list of custom taxonomy images on a page template?

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

  2. Diogo15
    Member
    Posted 2 years ago #

    The function wp_list_categories() wont return other taxonomies, use another function!
    Also get_category_link() is wrong!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic