I've tried a couple of methods but I cannot seem to filter custom
from my search results and was hoping someone could help.
I have installed "Job Manager" and created 4 jobs which have a custom
I tried to create a manual search form and set a hidden value of
but it still returned all posts.
I then tried creating a custom search page and redirecting the search to this page as follows (i.e added
hidden field):
And then in the custom search page, I added the following code (as per wordpress guide - <a href="http://codex.wordpress.org/Creating_a_Search_Page" rel="nofollow">http://codex.wordpress.org/Creating_a_Search_Page</a>) and I added the
of
to the query array:
And it still displays all posts...
What am I doing wrong? I have checked the
column in the
table and I have 4 unique entries...so they are there...
Any Insight?
Code:
post_types
I have installed "Job Manager" and created 4 jobs which have a custom
Code:
post_type = 'jobman_job'
I tried to create a manual search form and set a hidden value of
Code:
post_type = jobman_job
Code:
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value=""/>
<input type="hidden" name="post_type" value="jobman_job" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
I then tried creating a custom search page and redirecting the search to this page as follows (i.e added
Code:
page_id
Code:
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">
<input type="text" name="s" id="s" value=""/>
<input type="hidden" name="page_id" value="123" />
<input type="hidden" name="post_type" value="jobman_job" />
<input type="submit" id="searchsubmit" value="Search" />
</form>
And then in the custom search page, I added the following code (as per wordpress guide - <a href="http://codex.wordpress.org/Creating_a_Search_Page" rel="nofollow">http://codex.wordpress.org/Creating_a_Search_Page</a>) and I added the
Code:
post_type
Code:
jobman_job
Code:
global $query_string;
$query_args = explode("&", $query_string);
$search_query = array('post_type' => 'jobman_job');
foreach($query_args as $key => $string) {
$query_split = explode("=", $string);
$search_query[$query_split[0]] = urldecode($query_split[1]);
} // foreach
$search = new WP_Query($search_query);
And it still displays all posts...
What am I doing wrong? I have checked the
Code:
post_type
Code:
wp_posts
Any Insight?