• Hi There. very useful plugin. Thanks v much.

    I am using it in the sidebar of a store and trying to get it to show tag images for products within a category but, at the mo, its just showing all tag images.

    For example, I have a product category called ‘sunglasses’ and, in the category view for that, where my prods are listed, I want the sidebar to show tag images for all the prods in that category only.

    I am using this code – but its shows tag images for all products – not just the prods in the sunglasses category

    $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy'=> 'product_tag'));
     	if ( ! empty( $terms ) ) {
    		foreach( (array) $terms as $term ) {
    		print '<div style="float:left;margin-right:8px;"><a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '?product_cat=sunglasses">' . wp_get_attachment_image( $term->image_id, 'thumb10040' ) . '</a></div>' ;
    		}
    	}

    https://wordpress.org/plugins/taxonomy-images/

Viewing 1 replies (of 1 total)
  • Thread Starter aliferis

    (@aliferis)

    In an attempt to answer my own question, can I somehow combine these args with the ‘taxonomy-images-get-terms’ filter to achieve what I am after

    $args = array(
                'post_type'         => 'products',
                'post_status'       => 'publish',
                'posts_per_page'    => $num_posts,
                'tax_query'         => array(
                    'relation'      => 'AND',
                    array(
                        'taxonomy'  => 'product_cat',
    
                        'field'     => 'id',
                        'terms'     => $category,
                    ),
                    array(
                        'taxonomy'  => 'product_tag',
    
                        'field'     => 'id',
                        'terms'     => $tags
                    ),
                )
            );
Viewing 1 replies (of 1 total)
  • The topic ‘tag images for products in a category’ is closed to new replies.