• Resolved stahnke939

    (@stahnke939)


    I want to:

    1. Create a custom post type.
    2. Add extra fields to that custom post type using advanced custom fields.
    3. Create a custom search page completely separate from search.php that searches the custom post type and has multiple search/filter options (first name, last name, dropdown box 1, dropdown box 2, etc.)

    I know that options one and two are possible. However, is building a custom search page like described possible as a way to interact with the custom post type?

    Thanks!

    • This topic was modified 4 years, 5 months ago by Jan Dembowski.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Euler

    (@eulerarthur)

    Have you tried the plugin SearchWP?

    Thread Starter stahnke939

    (@stahnke939)

    I haven’t. I will give that a try. Thanks!

    Moderator bcworkz

    (@bcworkz)

    Yes, it’s possible. If Euler’s suggestion doesn’t help and you have the coding skills, the functionality you are after can all be handled by code on a custom page template. Through this mechanism, anything that PHP and JS can do is possible.

    Thread Starter stahnke939

    (@stahnke939)

    Thanks @bcworkz. That’s great to hear! Would this be powered using WP_Query or a different function?

    Moderator bcworkz

    (@bcworkz)

    Generally yes, but WP_Query may not be able to handle ALL of one’s query needs through its accepted parameters. There may be certain queries where the SQL WP_Query develops needs to be directly altered through filters to get the desired results. In some cases it may be simpler to compose your own SQL and run via the global $wpdb object methods.

    That said, if your queries are qualified by post meta, more than likely WP_Query will meet your needs. However, if you will have a huge number of posts to filter by post meta, that schema may not be performant and you may wish to consider a custom table for to store filter criteria. In that case WP_Query will not be helpful and you’ll need your own SQL.

    Thread Starter stahnke939

    (@stahnke939)

    Sounds good. Thanks for the help!

    Hi, I’m looking for a similar thing.

    I need to create a search field in the middle of the screen ( or wherever ) that has 2-3 fields.
    It’s for a job site for a friend i am reworking that will search jobs for job name, category and location. The themes dont let you use the search box as a shortcode so you are stuck with the layout.

    https://apusthemes.com/wp-demo/careerup/home-5/

    If anyone knows how to re create this search field ( link above ) in this theme or where to point me i would be so grateful.

    cheers
    steve

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Advanced search for custom post type with custom fields?’ is closed to new replies.