• Hello,
    Apparently it is not possible to use a fontawesome icon in the Filter Name box of the WooCommerce Ajax Product Filter plugin.
    The icon does not appear, but its code <i class=”fa-solid fa-star”></i>
    Can you help me resolve this problem please?

Viewing 1 replies (of 1 total)
  • Plugin Support Alessio Torrisi

    (@alessio91)

    Hi there,

    please add following code in the file functions.php of your theme.

    add_filter( 'yith_wcan_filter_title_html', 'yith_wcan_allow_html_on_filter_title', 10, 3 );
    
    if( ! function_exists( 'yith_wcan_allow_html_on_filter_title' ) ){
    	function yith_wcan_allow_html_on_filter_title( $title_html, $title, $filter ){
    		if ( ! $filter->get_title() ) {
    			return '';
    		}
    
    		$title_tag          = apply_filters( 'yith_wcan_filter_title_tag', 'h4', $filter );
    		$additional_classes = array( 'filter-title' );
    
    		if ( $filter->is_collapsable() ) {
    			$additional_classes[] = 'collapsable';
    			$additional_classes[] = ( $filter->is_active() && 'horizontal' !== $filter->get_preset()->get_layout() ) ? 'opened' : $filter->get_toggle_style();
    		}
    
    		$additional_classes = implode( ' ', apply_filters( 'yith_wcan_filter_title_classes', $additional_classes, $filter ) );
    		$title_html  = wp_kses_post( sprintf( '<%1$s class="%3$s">%2$s</%1$s>', $title_tag, $filter->get_title(), esc_attr( $additional_classes ) ) );
    		return $title_html;
    	}
    }

    Then be sure to use correctly quotes for the font awesome tag, I saw that copy and paste generated a wrong format in your text.

    <i class="fa-solid fa-star"></i>

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Font Awesome problem’ is closed to new replies.