Tagged: search results
I hacked up the search results to include tags in the search
file: wp-content\themes\enfold\framework\php\function-set-avia-frontend.php
elseif (is_search())
{
//start hack
global $wp_query;
$orig_query_found=false;
$tag_query_found=false;
$orig_query = $wp_query;
if($orig_query->found_posts){
// echo 'had a post for normal search<br/>';
$orig_query_found=true;
}else{
// echo 'no results for normal search<br/>';
$orig_query_found=false;
}
wp_reset_query();
query_posts( 'tag='.$_GET['s'].'' );
$tag_query = $wp_query;
wp_reset_query();
if($tag_query->found_posts){
// echo 'had a post for tag search<br/>';
$tag_query_found=true;
}else{
// echo 'no results for tag search<br/>';
$tag_query_found=false;
}
// $wp_query=$orig_query;
switch($orig_query_found){
case true:
switch($tag_query_found){
case true:
// echo 'should combine the array';
$wp_query->posts = array_merge( $orig_query->posts, $tag_query->posts );
// $wp_query=array_merge($orig_query,$tag_query);
break;
default:
// echo 'leave original results';
$wp_query=$orig_query;
break;
}
break;
default:
$wp_query->posts = $tag_query->posts ;
//since no results in original, just return the tag search
break;
}
//end hack
if(!empty($wp_query->found_posts))
Now have no errors if:
Hi brandonguy!
Thanks for sharing your changes :)
Cheers!
Devin