Support » Plugin: Taxonomy Images » [Plugin: Taxonomy Images] Thumbails with Subcategory List

  • Having a whale of a time with this one. On my main category page, I want to display all subcategories with their thumbnails which are set in the Taxonomy Images plugin. I’ve tried different sets of code listed on the plugin page, in a screencast I came across and various sites where people were looking for help with similar issues. No luck thus far.

    I’m working on a child theme of the Genesis framework, if that helps out in either way. Here’s a snippet of the code I’m using to display my subcategories – just need a way to add the images with them.

    add_action('genesis_before_loop', 'category_grid');
    function category_grid() {
    	$this_category = get_query_var('cat');
    	$subcategories = get_categories('child_of='.$this_category.'&hide_empty&orderby=title&order=asc'); // List subcategories of current category
    	echo '<div class="category-grid-listing">';
    	foreach ($subcategories as $subcategory) {
    	  echo sprintf('<div class="category-grid-box"><a href="%s">%s</a>', get_category_link($subcategory->term_id), $subcategory->name), '</div>';
    	echo '</div><!--category-grid-listing-->';

Viewing 1 replies (of 1 total)
  • Did you ever get your question resolved? This code works for me on a template page. As written, It displays all the subcategories of category 3, except subcategory 708, in a descending manner based on post count — and hides any that don’t have at least 2 posts. Feel free to change the parameters as you need.

    add_action('genesis_post_content', 'pmg_category_images'); // Adds your custom home page code
    function pmg_category_images(){ ?><div class="catimglist">
    	<?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>';
    			} ?> </div>
Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Taxonomy Images] Thumbails with Subcategory List’ is closed to new replies.