Forum Replies Created

Viewing 12 replies - 1 through 12 (of 12 total)
  • Hi Mel,

    try giving this a go:

    <?php
    /*
    Template Name: Advanced Search
    */
    ?>
    <?php $options = get_option( 'classy_theme_settings' ); ?>
    <?php get_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['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',
    			));
    		}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 } ?>
    </div>
    <?php get_sidebar('pages'); ?>
    <?php get_footer(''); ?>

    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.

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

    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.

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

    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?

    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.

    Is the email address on the same domain as the website?
    Example –

    Email: contact@mywebsite.com
    Website: http://www.mywebsite.com

    I ask because I had a problem before with Contact Form 7 where the host was assuming the mail was managed locally and so sending the mail locally rather than to my actual email (which was run by google).

    Try another email address to see if it’s a problem with the address or something else.

    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).

    Thread Starter EdTheDuck

    (@edtheduck)

    It’s up to date on everything, and it is working on other websites on the same server.
    I’ll try copying the theme somewhere else, but I have coded it like I do the rest.
    Thanks for all the help though.

    Thread Starter EdTheDuck

    (@edtheduck)

    Just tried that, no luck. It’s very odd, I’ve never had any trouble with it before.

    Thread Starter EdTheDuck

    (@edtheduck)

    Hi studioactiv8, thanks for the reply.
    I tried using [gallery=1] and although that shows in the admin visual editor, it still does the same on the actual post.
    The gallery is definitely number 1 and I used the button on the visual editor to add this tag in (just to be 100% sure it was correct).

    Any more ideas?

    Thread Starter EdTheDuck

    (@edtheduck)

    Sorry, here is the website and an example of it not working: http://www.carnivalcreative.com/blog/think-visibility-in-photos/

Viewing 12 replies - 1 through 12 (of 12 total)