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

    (@mikejolley)

    What code do you have, and are cats enabled/have any jobs?

    Thread Starter teensicle

    (@teensicle)

    Yes my site is fully operational and i have everything set up..

    i used this code https://wpjobmanager.com/document/tutorial-creating-custom-job-search-form/

    Plugin Author Mike Jolley

    (@mikejolley)

    Show me the page?

    Thread Starter teensicle

    (@teensicle)

    I created a test page here https://www.jobhuntja.com/test/

    Plugin Author Mike Jolley

    (@mikejolley)

    Thread Starter teensicle

    (@teensicle)

    Below is exactly what i posted, all i did was change the form actions as per the instructions on the support website. However, im having an issue

    <form method="GET" action="https://www.jobhuntja.com/jobs-in-jamaica-online/">
      <p>
        <label for="keywords">Keywords</label>
        <input type="text" id="search_keywords" name="search_keywords" />
      </p>
      <p>
        <label for="keywords">Location</label>
        <input type="text" id="search_location" name="search_location" />
      </p>
      <p>
      	<label for="search_category">Category</label>
      	<select id="search_category" name="search_category">
      		<?php foreach ( get_job_listing_categories() as $cat ) : ?>
      			<option value="<?php echo esc_attr( $cat->term_id ); ?>"><?php echo esc_html( $cat->name ); ?></option>
      		<?php endforeach; ?>
      	</select>
      </p>
      <p>
        <input type="submit" value="Search" />
      </p>
    </form>
    Thread Starter teensicle

    (@teensicle)

    Okay so now i got a plugin called insert php and it helped me out a bit however now the category listing doesn’t show

    Thread Starter teensicle

    (@teensicle)

    So using the plugin “insert php” i got the form to work but now im only seeing one category; this is really odd. Also on the tutorial website the line below had a : instead of a ; when i changed that, thats when i started getting only one category.

    <?php foreach ( get_job_listing_categories() as $cat ) : ?>

    <form method="GET" action="https://www.jobhuntja.com/jobs-in-jamaica-online/">
      <p>
        <label for="keywords">Keywords</label>
        <input type="text" id="search_keywords" name="search_keywords" />
      </p>
      <p>
        <label for="keywords">Location</label>
        <input type="text" id="search_location" name="search_location" />
      </p>
      <p>
      	<label for="search_category">Category</label>
    
    <select id="search_category" name="search_category">
    
    [insert_php] foreach ( get_job_listing_categories() as $cat ) ; [/insert_php]
    
     <option value="[insert_php] echo esc_attr( $cat->term_id ); [/insert_php]">
    
    [insert_php] echo esc_html( $cat->name ); [/insert_php]
    
    [insert_php] endforeach; [/insert_php]
    
    </option>
    
    </select>
      </p>
      <p>
        <input type="submit" value="Search" />
      </p>
    </form>
    Plugin Author Mike Jolley

    (@mikejolley)

    ‘insert_php’ should not be needed if you’re adding this code directly to your template. Thats how this is supposed to be handled.. Don’t add this to a wordpress ‘page’.

    Thread Starter teensicle

    (@teensicle)

    sigh… Can you point me in the right direction as to how i can add this to my home page

    Plugin Author Mike Jolley

    (@mikejolley)

    Either find the template which controls your homepage (or even the header template depending on where the form is going!) in the theme and add it there (as PHP code) or you’ll need to build a custom widget/shortcode to add it to content.

    PHP does not work in posts/pages.

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Custom search form not displaying job categories’ is closed to new replies.