Forums › Forums › Search & Filter Pro › Display of title with associated custom taxonomies above search results
- This topic has 7 replies, 2 voices, and was last updated 4 years, 9 months ago by Trevor.
-
Anonymous(Private) April 5, 2020 at 8:15 pm #239102
Hi, I am using your (terrific) plugin with Elementor Pro. I am having quite a hard time displaying a headline with the chosen custom categories above my search results. I mean: Search results for taxonomy a1, taxonomy a2, taxonomy b and taxonomy c.
I found your post:
https://support.searchandfilter.com/forums/topic/results-displayed-results-count-searched-tag-associated-categories/and adapted it for my use. It turned out quite well BUT this headline does not change when I select another filter. Can you think of any solution for this?
My code:
<?php global $searchandfilter; $sf_query = $searchandfilter->get(5360)->current_query(); if ($sf_query->is_filtered()) { $sf_current_query = $searchandfilter->get(5360)->current_query()->get_array(); echo "<b>Onderzoek met betrekking tot "; $cat_string = ""; foreach($sf_current_query['_sft_category']['active_terms'] as $item) { $cat_string .= $item['name'] . ", "; } $starost_string = ""; foreach($sf_current_query['_sfm_starost']['active_terms'] as $item) { $starost_string .= $item['name'] . ", "; } if (($sf_current_query['_sft_reflex-categorie']['active_terms'][0]['name'])<>"") echo "<p>" . ($sf_current_query['_sft_reflex-categorie']['active_terms'][0]['name']) . "</p>"; if (($sf_current_query['_sft_vaardigheden-categorie']['active_terms'][0]['name'])<>"") echo "<p>" . ($sf_current_query['_sft_vaardigheden-categorie']['active_terms'][0]['name']) . "</p>"; if (($sf_current_query['_sft_diagnose-categorie']['active_terms'][0]['name'])<>"") echo "<p>" . ($sf_current_query['_sft_diagnose-categorie']['active_terms'][0]['name']) . "</p>"; echo "</b>"; } ?>
My CSS:
p {
margin: 0;
display: inline;
}p:not(:last-child)::after { content: ” & “; }
p:last-child::after { content: “”; }Thank you so much in advance!
MoniqueAnonymous(Private) April 5, 2020 at 8:23 pm #239103BTW I am using Elementor Pro with your plugin Search & Filter – Elementor Extension.
Display results method is set to Elementor posts / portfolio / Products
Template Options lead to a page I created to display the search results with your Search en Filter widget on it.Trevor(Private) April 6, 2020 at 9:50 am #239115This post (I have made it public so you can see it) might help much better:
https://support.searchandfilter.com/forums/topic/page-title-for-search-results/page/2/#post-238475
It is very useful becasue it shows how to code if a field has/can have more than one term set.
Trevor(Private) April 22, 2020 at 3:33 pm #240959The code must be INSIDE the Ajax Container on the page for Ajax refresh changes to reflect in the titles. So, either move the code into that container, or choose a container that is a parent that does contain the code.
That might prove difficult though.
-
AuthorPosts