Forum Replies Created

Viewing 1 replies (of 1 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.
Viewing 1 replies (of 1 total)