TitleCase Facets title in Filters with Hook
- prakashreddy.imduriParticipant8 months ago #35485
Hi, Is there any hook to title case the facets labels, I have some taxonomy with full uppercase. I want to use ucwords php function, but Can you suggest some hook which takes in the label and returns modified label.
wpsolrKeymaster8 months ago #35486You can use WPSOLR_Events::WPSOLR_FILTER_SEARCH_PAGE_FACET_NAME.
use wpsolr\core\classes\WPSOLR_Events;
add_filter( WPSOLR_Events::WPSOLR_FILTER_SEARCH_PAGE_FACET_NAME, ‘get_field_label’, 10, 1 );
function get_field_label( $custom_field_name ) {
return ucwords($custom_field_name);
}prakashreddy.imduriParticipant8 months ago #35487Its changing the filter label, I wanted to change the taxonomy terms inside the filter..
The above code is changing the filter headings, like By Category, By Tag..
Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.