Try amending the Loop in search.php to use something like:
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php if(is_page(array('Foo', 'Bar', 'Wibble')) continue;?>
where Foo, Bar, Wibble are the titles of Pages that you don’t want to show.
Didn’t work, I received the following error:
Parse error: syntax error, unexpected T_CONTINUE in C:\xampp\htdocs\wordpress\wp-content\themes\bluebox\search.php on line 10
I also have this problem. I’m using a simple redirect on my pages to send users to a different part of my website (shop,community,etc). Also when one of those pages show up in a search result it redirects from the search page to where ever that page was redirected to.
You can check out the problem on my page: http://www.spaceageminds.com
The pages that redirect is “Products” and all of its subpages and “Community” and all of its subpages.
If you do a search for “community” the page shows up in the results and after 1 or 2 seconds redirects the user.
edit: Also I don’t have a search.php in my theme. I’m using a modified Lightword theme I think this is the code responsible for my search but I have limited wordpress skills so I might be wrong.
// SEARCH BOX / WORDPRESS BASIC SEARCH OR GOOGLE CSE
function lw_searchbox(){
global $lw_remove_searchbox, $lw_google_search_code;
$lw_google_search_code = trim(str_replace(" ","",$lw_google_search_code));
if($lw_remove_searchbox != "true")
if(!empty($lw_google_search_code)){
?>
<form action="http://www.google.com/cse" method="get" id="searchform">
<input type="text" class="textfield" name="q" size="24" id="s"/>
<input type="submit" class="button" name="sa" value="" id="go"/>
<input type="hidden" name="cx" value="<?php echo $lw_google_search_code; ?>" />
<input type="hidden" name="ie" value="UTF-8" />
</form>
<?php }else{ ?>
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>"> <input type="text" value="" name="s" id="s" /> <input type="submit" id="go" value="" alt="<?php _e('Search'); ?>" title="<?php _e('Search'); ?>" /></form>
<?php
}
}
Anything at all would be helpful.
Thank you.