Cannot get rid of the character '. It produces a diamond with question marks that code. Already tried everything.
if ( $terms ) { $i = 2; printf( '<div class="%s"> <h2 class="text-center">Select one of the functional areas</h2> <ul class="clearfix">', esc_attr( $class ) ); printf( '<li class="'.$activet.'" ><a href="%s">All categories</a><div class="description">All categories on one page</div></li>', esc_url( site_url() )); foreach ( $terms as $term ) { $active =''; // The $term is an object, so we don't need to specify the $taxonomy. $term_link = get_term_link( $term ); $term_name = esc_html( $term->name ); $clean = preg_replace("/[^\w]/", "", $term_name); $name = "/\b".$clean."\b/i"; if (preg_match($name,$link) == true && preg_match($name,$url) == true) { $active = 'active-taxonomy'; } else { $active =''; } // If there was an error, continue to the next term. if ( is_wp_error( $term_link ) ) { continue; } printf( '<li class="'.esc_html( $term->name ).' '.$active.'" ><a href="%s">%s</a><div class="description">%s</div></li>', esc_url( $term_link ), esc_html( $term->name ),esc_html( $term->description ) ); if (($i % 3) === 0) { echo '<li class="clear"> </li>'; } $i++; } print( '</ul></div>' ); }
If you do this:
if ( $terms ) { $i = 2; printf( '<div class="%s"> <h2 class="text-center">Select one of the functional areas</h2> <ul class="clearfix">', esc_attr( $class ) ); printf( '<li class="'.$activet.'" ><a href="%s">All categories</a><div class="description">All categories on one page</div></li>', esc_url( site_url() )); foreach ( $terms as $term ) { $active =''; // The $term is an object, so we don't need to specify the $taxonomy. $term_link = get_term_link( $term ); $term_name = $term->name; $clean = preg_replace("/[^\w]/", "", $term_name); $name = "/\b".$clean."\b/i"; $low = strtolower($name); $link = strtolower($term_link); if (preg_match($name,$link) == true && preg_match($name,$url) == true) { $active = ' active-taxonomy'; } else { $active =''; } // If there was an error, continue to the next term. if ( is_wp_error( $term_link ) ) { continue; } printf( '<li class="'.$low.$active.'" ><a href="%s">%s</a><div class="description">%s</div></li>', esc_url( $term_link ), esc_html( $term->name ),esc_html( $term->description ) ); if (($i % 3) === 0) { echo '<li class="clear"> </li>'; } $i++; } print( '</ul></div>' ); }
That issues - hildrensroom. I generally can not understand in this case. I will be glad to any help.