Viewing 15 replies - 1 through 15 (of 39 total)
  • I need this too.
    I have tried various custom field search plugins but none seem to work (I presume because they’re searching posts, not jobs).

    All I want is a dropdown to pick a salary range (defined in the job) and a region (also defined in the job).

    I could do with a feature like this too… I need to be able to have a few drop downs defining: Job category, Salary range and Location?

    A bit like this site: https://www.timeappointments.co.uk/

    hi guys have you figured this out yet? i am dying to have this for my site too? would love to know thanks so much in advance- wendy

    search would be great!

    Since people are still asking for it I thought I would offer the solution I came up with.

    I created my own search page as a template and used the following code to filter results based on a few criteria.

    query_posts(array(
    	'post_title' => 'LIKE %'.$_GET['keyword'].'%',
    	'post_type' => 'jobman_job',
    	'meta_query' => array(
    		array(
    			'key' => 'data8',
    			'value' => $salary,
    		),
    		array(
    			'key' => 'data9',
    			'value' => $location,
    		),
    	),
    	'posts_per_page' => '10',
    ));

    As you may assume, data8 was the systems salary field which I created (this was a range selection so typing in a figure is not possible) and data9 was the location.

    Thanks EdtheDuck, i’ll give it a go

    Where should I post that code, Ed?

    Hi Mel,

    This is to be placed in a template file for your theme.
    Just posting this bit of code won’t work though as you will need to create a form and output for the query so an understanding of WordPress and PHP is really needed.

    I may write a more in-depth tutorial on how I got this working if anyone is interested?

    I am interested in a more in-depth tutorial how you did it. I know basic PHP and I am just beginning to understand WordPress.

    Ok, well if I get some time tonight I will put something together and you can be the first test victim ??

    Yay!! I would greatly appreciate that. I’m working on a client project that want to search for job locations because they will have a lot of postings. Could that be implemented into a simple widget?

    I would think so, although I will only have time to write a tutorial on creating a search page and results page tonight.

    hopefully you can work out how to include the form in a widget.

    Did you get time to do the tutorial? I was just wondering.

    Hi Mel,

    I have created a 1st draft but I was simply typing as I was thinking so it’s a little hard to follow.

    Feel free to have a go though as it may be a few days before I get chance to re-write it.

    https://danmcguire.co.uk/creating-an-advanced-job-search-for-the-jobman-wordpress-plugin/

    I got it to work but it doesn’t search for all of the listings, only one shows up.
    Below is my code, also the website (https://project.job1usa.com/test/) is what I’m testing on so feel free to test it out for yourself.

    <?php
    /*
    Template Name: Advanced Search
    */
    ?>
    <?php $options = get_option( 'classy_theme_settings' ); ?>
    <?php get_header(''); ?>
    <?php
    //start loop
    if (have_posts()) : while (have_posts()) : the_post();
    //get featured image
    $featured_image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'page-header' );
    ?>
    <?php
    //if post has thumbnail
    if( has_post_thumbnail() ) { ?>
    <div id="page-header">
    <img src="<?php echo $featured_image[0]; ?>" alt ="<?php the_title(''); ?>" width="980" />
    </div>
    <!-- END #page-header -->
    <?php } ?>
    <div id="post">
        <h1 class="page-title"><?php the_title(); ?></h1>
        <?php the_content(); ?>
        <?php
    	if(!isset($_GET['keyword'])){$_GET['keyword']="";}
    	if(!isset($_GET['location'])){$_GET['location']=0;}
    ?>
        <form action="#" methond="get">
        <ul>
        	<li>
        		<label for="keyword">Keyword</label>
        		<input type="text" name="keyword" value="<?php echo strip_tags($_GET['keyword']); ?>" />
        	</li>
        	<li>
        		<label for="location">Location</label>
    			<select name="location">
    			<option value="0"<?php if($_GET['location']==0){?> selected="selected"<?php } ?>>Any</option>
    			<option value="1"<?php if($_GET['location']==1){?> selected="selected"<?php } ?>>Toledo, OH</option>
    			<option value="2"<?php if($_GET['location']==2){?> selected="selected"<?php } ?>>Delta, OH</option>
    			<option value="3"<?php if($_GET['location']==3){?> selected="selected"<?php } ?>>Findlay, OH</option>
    		</select>
    		</li>
    	<input type="submit" value="Search" />
    	</ul>
    </form>
    <?php if($_GET['keyword']!=""||$_GET['salary']!=0||$_GET['location']!=0){ ?>
    	<h2>Search Results</h2>
    	<ul id="jobs-two">
    		<?php //query_posts('post_type=jobman_job&posts_per_page=10'); ?>
    		<?php
    		$_GET['keyword'] = trim($_GET['keyword']);
    		if($_GET['keyword']==""){$_GET['keyword']=" ";}
    		if($_GET['location']!=0){
    			switch($_GET['location']){
    				case 1:
    					$location = 'Toledo, OH';
    					break;
    				case 2:
    					$location = 'Delta, OH';
    					break;
    				case 3:
    					$location = 'Findlay, OH';
    					break;
    			}
    		}
    		if($_GET['location']!=0){
    			query_posts(array(
    				'post_title' => 'LIKE %'.$_GET['keyword'].'%',
    				'post_type' => 'jobman_job',
    				'meta_query' => array(
    					array(
    						'key' => 'data4',
    						'value' => $location,
    					),
    				),
    				'posts_per_page' => '10',
    			));
    		}
    		elseif($_GET['location']!=0){
    			query_posts(array(
    				'post_title' => 'LIKE %'.$_GET['keyword'].'%',
    				'post_type' => 'jobman_job',
    				'meta_query' => array(
    					array(
    						'key' => 'data4',
    						'value' => $location,
    					),
    				),
    				'posts_per_page' => '10',
    			));
    		}else{
    			query_posts(array(
    				'post_title' => 'LIKE %'.$_GET['keyword'].'%',
    				'post_type' => 'jobman_job',
    				'posts_per_page' => '10',
    			));
    		}
    		?>
    		<?php $count = 0; ?>
    		<?php while (have_posts()) : the_post(); ?>
    		<?php if(strstr(get_the_title(),trim($_GET['keyword']))){ ?>
    		<li>
    			<strong><?php the_title(); ?></strong><br />
    			<strong>Location:</strong> <?php $location = get_post_custom_values('data4'); echo $location[0]; ?><br />
    			<a href="<?php the_permalink() ?>">More</a>
    		</li>
    		<?php $count++; ?>
    		<?php } ?>
    		<?php endwhile;?>
    		<?php if(!$count){ ?>
    		<p><strong>Sorry but your search returned no jobs. Please try again.</strong></p>
    		<?php } ?>
    	</ul>
    <?php } ?>
    
        <?php comments_template(); ?>
    </div>
    <!-- END post-content -->
    <?php endwhile; ?>
    <?php endif; ?>
    <?php get_sidebar('pages'); ?>
    <?php get_footer(''); ?>

    I took out the salary section since I didn’t need it.

Viewing 15 replies - 1 through 15 (of 39 total)
  • The topic ‘Searching jobs’ is closed to new replies.