• Resolved roninreilly

    (@roninreilly)


    filter attribute images not loading. In by “brand” attribute i have attribute icon field by WOODMART theme. When i upload images in all attributes variations A space appeared in the filter with the field “class: wpc-term-image-container” with “url(Array)“. But no images there. In console i have Array:1 Failed to load resource: the server responded with a status of 404 (). Help me with this please.😌

    by the way this is best filter plugin for woocommerce and not only. Thanks to the developer

    • This topic was modified 3 years, 5 months ago by roninreilly.
    • This topic was modified 3 years, 5 months ago by roninreilly. Reason: appreciate
    • This topic was modified 3 years, 5 months ago by roninreilly.
    • This topic was modified 3 years, 5 months ago by roninreilly.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter roninreilly

    (@roninreilly)

    I fixed it with the following code:

    add_filter( 'wpc_filters_checkbox_term_html', 'wpc_term_brand_custom_logo', 10, 4 );
    add_filter( 'wpc_filters_radio_term_html', 'wpc_term_brand_custom_logo', 10, 4 );
    function wpc_term_brand_custom_logo($html, $link_attributes, $term, $filter)
    {
        $img = '';
    
        // Desired taxonomy 'pa_brand'
        if( $filter['e_name'] !== 'pa_brand' ){
            return $html;
        }
    
        if( ! isset( $term->slug ) ){
            return $html;
        }
    	$src = get_term_meta($term->term_id, 'image', true);
    	$urlimage = wp_get_attachment_image_url($src['id'],'full');
    
    	if( $src ){
    		$img  = '<span class="wpc-term-image-wrapper"><span class="wpc-term-image-container" style="background-image: url('.$urlimage.')"></span></span>';
    
    		$html = '<a '.$link_attributes.'>'.$img . ' '. $term->name.'</a>';
    	}
    
        return $html;
    }
    • This reply was modified 3 years, 5 months ago by roninreilly.
    • This reply was modified 3 years, 5 months ago by roninreilly.
    Plugin Author stepasyuk

    (@stepasyuk)

    Hello @roninreilly

    Thank you for using Filter Everything and for the code you provided.

    I’ve added this code part which takes into account that $src could be an array to the next pluign update.

    @roninreilly Hey Bro,
    I’m facing same issue with my site,
    https://gaellelevycosmetics.com/en/shop-3/
    Images are not loading on filtering.

    How can i fix it?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘filter attribute images not loading’ is closed to new replies.