Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Mike Jolley

    (@mikejolley)

    Create a select box with name ‘search_category’ and the jobs page will pick that up. You can hardcode the location values or use a function to get terms.

    This 3rd party plugin lets you add regions but I’m not 100% sure if it will pick up the search query for locations https://www.ads-software.com/plugins/wp-job-manager-locations/

    Thread Starter theplastickid

    (@theplastickid)

    Do you know what the function to get job categories might look like?

    Thread Starter theplastickid

    (@theplastickid)

    This is what I currently have:

    <form method="GET" action="https://localhost/my_site/jobs/">
      <?php wp_dropdown_categories( array( 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'show_option_all' => __( 'Any category', 'wp-job-manager' ), 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category ) ); ?>
      <input type="text" placeholder="Location" onfocus="this.placeholder = ''" onblur="this.placeholder = 'Location'" id="search_location" name="search_location" />
      <input class="advanced" type="button" value="Advanced Search" ONCLICK="window.location.href='index.php?page_id=13'" />
      <input class="search" type="submit"  value="Find a job" />
    </form>
    Plugin Author Mike Jolley

    (@mikejolley)

    That looks fine?

    Thread Starter theplastickid

    (@theplastickid)

    Thanks I am getting there with it. I am just trying to loop through the locations to output these into a drop down also.

    Do you know which template file this line of code uses so I might reference it.
    <?php do_action( 'jobify_output_job_results' ); ?>

    Thanks for your help Mike

    Thread Starter theplastickid

    (@theplastickid)

    This is what I have so far

    <select name="search_location" id="search_location">
    <?php foreach ( get_job_location() as $regions ) : ?>
    <option value="<?php echo $regions->slug; ?>"
    <?php echo $regions->name; ?></option>
    <?php endforeach; ?>
    </select>
    Plugin Author Mike Jolley

    (@mikejolley)

    You may be able to use wp_dropdown_categories too – the taxonomy would be job_listing_region if you’re using the regions plugin.

    if you’re not, doing a dropdown won’t be possible.

    Thread Starter theplastickid

    (@theplastickid)

    Hi I seem to have it working with the following code:

    <form method="GET" action="https://localhost/kenny_whelan/jobs/">
    <p class="keywords col-lg-4">
    <?php wp_dropdown_categories( array( 'taxonomy' => 'job_listing_category', 'hierarchical' => 1, 'show_option_all' => __( 'Any Category', 'wp-job-manager' ), 'name' => 'search_categories', 'orderby' => 'name', 'selected' => $selected_category ) ); ?>
    </p>
    <p class="location col-lg-4">
    <?php wp_dropdown_categories( array( 'taxonomy' => 'job_listing_region', 'hierarchical' => 1, 'show_option_all' => __( 'Any Region', 'wp-job-manager' ), 'name' => 'search_categories','show_count'         => 2, 'orderby' => 'name', 'selected' => $selected_category ) ); ?>
    </p>
    <p class="buttons col-lg-4">
    <input class="advanced" type="button" value="Advanced Search" ONCLICK="window.location.href='index.php?page_id=13'" />
    <input class="search" type="submit"  value="Find a job" />
    </p>
    </form>

    However why I click the submit button the results are not reflect in the job results which is odd as this was functioning correctly when I was using input fields and not drop downs.

    Also in order to customise the layout of the job results section which template file would I edit.

    Thanks Mike

    Plugin Author Mike Jolley

    (@mikejolley)

    Your 2nd field has name ‘search_categories’ instead of ‘search_region’

    Thread Starter theplastickid

    (@theplastickid)

    Seems to have done the job.

    In order to customise the layout of the job results section which template file would I edit?

    I’ll get this marked as resolved.

    Thanks for your help.

    Plugin Author Mike Jolley

    (@mikejolley)

    content-job_listing.php will control each item in the list.

    Thread Starter theplastickid

    (@theplastickid)

    Thanks Mike,

    This wasn’t working however I am using a theme ‘jobify’ which happens to already have a template override in place. It is this file that I needed to edit.

    can anyone give me the search form code of WP job manager for three field like text, category and subcategories ?

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Creating a custom search form’ is closed to new replies.