Build easily an advanced WordPress search in 5 minutes
Build an advanced search in few minutes with LSCF WordPress plugin. It’s easy and no coding skills are required. Generate a shortcode and use it in any page from website.
Beside a regular WordPress post title and content search, LSCF brings extra custom fields that you can use to add more flexibility to your advanced search. Using these custom fields, we can extend the search algorithm to look for extra keywords into these LSCF custom fields and build a higher match for search results.
LSCF can build an advanced WordPress search using pages, posts or any custom post type.
- We’ll start with creating an advanced search shortcode for regular WordPress posts from LSCF “Custom Filter” tab. We’ll select the custom post type as “Post” as we are building a search for regular posts.
2. From “Custom Fields” section we shall select “Search” to add the search field to our shorcode. Beside this, we’ll include one more category filter and we’ll call it “Regions” for showing few extra search options, later in this tutorial.
Click on “Search” from dropdown and then click “Add”. Then we’ll add a field name to it called “Search” as shown in screenshot below:
3. Generate the shortcode and add it to your WordPress page:
4. Remove the posts results and make the WordPress search to link/redirect to page results by adding 2 extra parameters to shortcode display=”filters_only” redirect_page=”[A WordPress page link that will have the same search LSCF shortcode]“. You can find more details about these 2 params in the LSCF’ documentation: https://pixolette.com/docs/lscf/lscf-shortcodes/
Watch the all steps how to generate LSCF shortcode and make an advanced WordPress search in the video below:
Make the advanced WordPress search more accurate in filtering using LSCF custom fields
Working with WordPress page builders and many other 3rd party plugins, we’ll find out that making a regular WordPress search by post title and post content isn’t so accurate. We can have a lot of text and many shorcodes from page builders in the post content that may trigger the search keywords and bring unexpected results.
LSCF provides extra options which will add more flexibility to our advanced search. We can customise the search algorithm to look in post tile only, post content only, custom fields only or into all together:
Beside the search options options LSCF brings a Conditional Logic for our ajax search. This reflects how the LSCF performs the search into “Post Title”, “Post Content” and any custom fields. Having the following active search options: Post Title and Post Content, and OR as conditional logic will bring the posts results that have the search keywords in their “Post Title” or “Post Content”. The AND conditional logic will bring the posts results which have an exact match of search keywords in their “Post Title” and “Post Content” at the same time.
Watch the video below to see how we extended our advanced WordPress search to look into a Post Title and LSCF custom field called Keywords.
Once the advanced search is set up and working properly, we can perform a custom sorting or a default ordering on search results. Explore the search plugin sorting and ordering options from Frontend Editor options.
Customise the post search results
LSCF is an advanced WordPress search plugin that comes with few predefined search results template. A search results template customisation can be done via a custom template option. This is the recommended option. So any HTML or CSS changes are will not get lost on plugin’s update. Add more value to your advanced WordPress search template via LSCF data tags.
Find more about LSCF advanced WordPress search custom template and custom tags in LSCF plugin’s documentation: https://pixolette.com/docs/lscf/custom-template/.