Using Advanced Custom Fields in post search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Using Advanced Custom Fields in post search

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 6 years, 4 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #15672
    coolhandstudios
    coolhandstudios
    Participant

    Hi there,

    Hope you are well.

    Attached is a screenshot of the search functionality of the website im developing for a recruitment company.

    Ideally I want the user to be able to type in “keywords” for the job (a field the admin sets in the post on the backend”
    Then user will then be able to select from Area, Salary and then job type before hitting the search button.

    Is this possible? Iv’e tried to do this but I can’t seem to figure it out.

    When the user clicks the search button they should be taken to a new search page, we don’t want the search box popping up there and then.

    If you go into the advanced custom fields section you can see the fields I have setup for vacancies, please feel free to edit if you need to.

    If you go into the post section, all the posts under “Vacancies” are the job listings that will fall under the search. If you go into one of these, you can see the parameters there.

    If you could email me when you reply that would be appreciated.

    [email protected]

    Thanks,

    Damon

    Attachments:
    You must be logged in to view attached files.
    #15678
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Damon,

    Thank you very much for the details, it makes my work much easier.

    While configuration is not part of support, I did what I could to make it as close as possible to your desired layout.

    1. Results redirection
    Since you don’t need live search, but want to redirect the results to the results page, the first thing was to change this behavior on the General Options -> Logics & Behavior panel: https://i.imgur.com/1EEOqgN.png

    Now whenever the user hits enter on the search field, or clicks the magnifier/search button he gets redirected to the results page. More information in Return key and magnifier icon click actions Documentation

    2. Search bar and button
    The problem is, that there is no separate search button that you can place by the search bar, it is integrated to the search input itself. So my solution was to:
    – re-enable the search bar, as you had it disabled: https://i.imgur.com/zMZMOTB.png
    – instead of the current shortcode, use the following on your front page: https://i.imgur.com/29wkmPs.png
    I have made this shortcode with the Shortcode Generator.
    This will place the search box to the left and the settings to the right, in a width ratio of 30/70.
    – Added some custom CSS to fix theme specific alignments: https://i.imgur.com/MKYCgty.png

    The result is the following: https://i.imgur.com/jPNJBtr.jpg

    Now the search redirects to the results page whenever the user clicks on the search button, and is positioned as close as possible to your needs.
    I hope this helps!

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


    #15680
    coolhandstudios
    coolhandstudios
    Participant

    Hi Ernest,

    Thanks for the swift response.

    I’ll look at this tomorrow, it seems pleasing.

    Regarding the search functionality, does this work directly with advanced custom fields? Is there a way to eliminate the “custom fields” section and just search from the paramaters iv’e set in ACF for the search?

    i.e.

    Key words, Area, Salary, Job types.

    As these are set in the posts.

    Thanks

    Damon

    #15681
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi Damon,

    Of course, you can search within the custom fields created by ACF. On the General Options -> Sources panel you can choose which custom fields to search within. I see you already did that.
    Basically if you remove the custom field filters, and turn off the front-end options alltogether, it will simply search those fields without filtering and return results based on them. In this case don’t forget to change the search shortcode on the front-end back to the default one.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Using Advanced Custom Fields in post search’ is closed to new replies.