Forums › Forums › Search & Filter Pro › Urgent – Custom Search Pages
Tagged: custom search
- This topic has 5 replies, 2 voices, and was last updated 4 years, 7 months ago by Trevor.
-
Anonymous(Private) March 15, 2020 at 3:27 pm #236719
Hi,
On my website, I have 4 post categories (Cat1, Cat2, Cat3, Cat4).
I also have 4 custom fields for each category (F1, F2, F3, F4).
And 1 Tag (T1) which is common for all post categories.My problem is I want to create 4 search pages (1 for each category, showing 2 dropdowns, one for the field (F1, F2…) and one for the tag (T1) as follows:
Category Cat1 page:
F1 – (dropdown)
Tag – (dropdown)
<Search>I want Tag dropdown to adjust according to the value selected in F1.
Also, the user should not have to select the category, the search form page should be automatically dedicated to it.
Can you please help how to set up these pages?Trevor(Private) March 16, 2020 at 9:57 am #236735If these are what are known as category term archive pages, such as:
mywesbite.com/category/cat1/
ormywesbite.com/cat1/
(depending on how your permalinks are setup)Then set the Display Results method to ‘Post Type Archive’, place the category field in the form, and then use custom CSS to hide it, maybe (where the ID number changes to match that of your form):
.searchandfilter[data-sf-form-id="1428"] .sf-field-category { display: none; }
And then, on the General Settings tab, enable Auto Count (both settings) and also Auto Detect for Tags, Categories and Taxonomies.
Then, in the custom field and tag fields, set these to Hide Empty.
This assumes that you theme uses fairly standard PHP archive templates.
This method would mean you use one form that will change/adapt depending on the page it is on.
Anonymous(Private) March 16, 2020 at 3:51 pm #236821Thanks, Trevor for your response.
I was able to add custom field and tag dropdown based filtering yesterday. As you mentioned, I also enabled ‘hide empty’ on tags to remove empty tags from the drop-down list which looks great.
What I am stuck now is on setting up the relation between custom field and tag values.
For instance, say the user selects a value from custom field dropdown = “DECEMBER”. Then tags dropdown should only show relevant tags from posts having custom field value = DECEMBER.
Can you please elaborate on how to achieve this? Thanks
-
AuthorPosts