Forums › Forums › Search & Filter Pro › How to show the currently selected title only
Tagged: format category title
- This topic has 21 replies, 2 voices, and was last updated 7 years, 7 months ago by Anonymous.
-
Anonymous(Private) May 12, 2017 at 4:15 pm #108528
I see, well it’s in use with a category radio button field, not a search form. Do you think this is why it is returning empty?
As you can see on this page under the “category +” button, this is what is being used. There is no search form currently.
Anonymous(Private) May 12, 2017 at 4:25 pm #108535Okay, but the checkboxes are directly from the S&F Plugin shortcode so does it not use the same kind of query as a search?
If it can’t be resolved with PHP, would you suggest a work around? I really want to get this to work because I am basing my whole search/browse functionality on S&F
Anonymous(Private) May 13, 2017 at 2:49 pm #108628Hi Trevor,
UPDATE! I’ve managed to half get it working!!!
It now works for all categories except the “All Categories” one, this seems to behave differently to the others and the code I have used doesn’t bring it in:
$sf_current_query = $searchandfilter->get(766)->current_query()->get_array(); echo $sf_current_query['_sft_category']['active_terms'][0]['name'];
I’ve left the printr statement in on the live site so you can get a picture of what is happening. I presume there may need to be an if statement added but I have yet to be able to pull in the “All categories” heading… I was however thinking of just hard coding a title in as it is only one title?? But i’m not sure how I would do it. I’m sure there is a “proper” fix to this though?
I hope you have a good weekend
-
AuthorPosts