• Resolved sablednah

    (@sablednah)


    I’m trying to get all the attached images for children of the current taxonomy. They’re going into a slider with names links and descriptions so I really need an array of result information.

    So far I have this…

    $header_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
    $header_args = "";
    
    if ($header_term) {
    	if ($header_term->parent == 0) {
    		$header_args = array ('taxonomy'=>'prodcat','hide_empty'=>0,'depth'=>0,'hierarchical'=>true,'child_of'=>$header_term->term_id );
    	} else {
    		$header_args = array ('taxonomy'=>'prodcat','hide_empty'=>0,'depth'=>0,'hierarchical'=>true,'child_of'=>$header_term->parent );
    	}
    } else {
    	$header_args = array ('taxonomy'=>'prodcat','hide_empty'=>0,'depth'=>0,'hierarchical'=>true);
    }

    and then…

    $roots_terms = apply_filters( 'taxonomy-images-get-terms', '' , array( 'taxonomy' => 'prodcat', 'term_args' => $header_args )  );
    
    if ( ! empty( $roots_terms ) ) {
    	$roots_head_img = '';
    	foreach( (array) $roots_terms as $roots_term ) {
    		$roots_head_img .= wp_get_attachment_image( $roots_term->image_id, 'full' ) ;
    		$roots_head_img .= '<h4><a>taxonomy ) ) . '">' . $roots_term->name . '</a></h4>';
    		$roots_head_img .= '<p>' . $roots_term->description . '</p>';
    	}
    }

    But I’m just getting all the images all the time, not just the children of the current taxonomy.

    What did I do wrong? 😉

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

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Taxonomy Images] Taxonomy children images.’ is closed to new replies.