Hide facet filter in frontend
- prakashreddy.imduriParticipant2 years, 7 months ago #30872
Hi, How Can I hide a particular facet from facet widget, even after its added to Data tab 2.2 and also filter, Can you help me with this ?
wpsolrKeymaster2 years, 7 months ago #30873You could be interested in this topic about hiding certain facet values
prakashreddy.imduriParticipant2 years, 7 months ago #30881Actually, the solution provided in the link is a bit different, I checked those options, its showing list of each item in parent facet to hide, What I was looking for is to hide the entire parent facet, some particular ones, which needs to be there in data and filter but not render into html.
prakashreddy.imduriParticipant2 years, 7 months ago #30883Any option, with filter enabled in 2.4. Any hook or condition to add in some file which can match that facet and hide in html, if we provide facet id ?
prakashreddy.imduriParticipant2 years, 7 months ago #30886I have inspected the filters, and found there is a class being added to each facet like wpsolr_facet_xxxx_str . So any place where I can mention this class name, to stop it rendering, not preferably with css or jquery..
wpsolrKeymaster2 years, 7 months ago #30887You can try:
<?php use wpsolr\core\classes\WPSOLR_Events; add_filter( WPSOLR_Events::WPSOLR_FILTER_UPDATE_FACETS_DATA, 'hide_facets', 10, 1 ); /** * * Hide facets. * * @param array $facets_data * * @return array */ public function hide_facets( $facets_data ) { /** * unset the facet from $facets_data['facets'] */ return $facets_data; }
You must be logged in to reply to this topic.