• Hey Gang, I posted this over the holiday weekend and got zero responses… here’s a new tactic… CASH. I’m new to working with searchable custom post types (these are being used for a job board) and need to know how I’d write the search query for the following:

    I have a custom post type called “opportunities” where each post is assigned a category “profession” and sometimes a child-category “specialty”. Each custom post also has a custom field for “state”.

    My search form is built out using Ajax so when a user selects a parent “profession” the sub-set of “specialty” auto-populates when there are sub-categories of that parent followed by a select-box full of states.

    What I need to know is how I’d write the custom query to receive those variables from my form and only show results refined by child-cat (if it exists), otherwise parent-cat and state custom field.

    Currently I’ve created a separate page template to return the search results to and the following query args:

    <?php
            $args = array(
                'post_type'=> 'opportunities',
                's'    => $s);
                query_posts($args);
    ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Help me write this query!’ is closed to new replies.