Andy6350
asked on
Wordpress search removes navigation menu
Here is a weird one!
I have a search facility on the following website
http://www.bluebean.org.uk/current/
When i search for anything it is fine, however, if i search more than one word (i.e put any spaces in the search) it removes the top nav.
Please can someone shine some light on this subject.
Many Thanks,
Andrew
I have a search facility on the following website
http://www.bluebean.org.uk/current/
When i search for anything it is fine, however, if i search more than one word (i.e put any spaces in the search) it removes the top nav.
Please can someone shine some light on this subject.
Many Thanks,
Andrew
It seems you are having a javascript conflict. Try disabling your plug-ins to see if it works. If it does then you can enable them one at a time to find the culprit.
ASKER
I haven't tried that, although when i switch back to the twenty ten theme, the search seems to work fine. So i think its something i have modified in the loop perhaps. Finding out what it is i dont know.
Is it worth attaching my file for you to view?
Thanks,
Is it worth attaching my file for you to view?
Thanks,
Sure, it could be possible that you have altered a theme file which results in the error. It actually makes more sense because you are able to search for a word without a space in the text. I will look at it for you.
ASKER
Is your template using a search.php file? That is where the search template is.
View the source of the page and try to determine which template is being loaded. Put a html comment in your template files if you need to.
View the source of the page and try to determine which template is being loaded. Put a html comment in your template files if you need to.
ASKER
My template does use a search.php file which i dont think i modified at all. When i switch to the twenty ten theme it works fine. Is it work replacing the twenty ten search.php file with my own one and see if it breaks the twenty ten theme?
This is from Perishable Press. You will need to create a custom file named searchform.php and place it in the root of your theme folder. Here is the code for the searchform:
Here is a nice coded search page accomponied with a good page.php template from ThemeShaper (also know as Automatic):
Here is the search.php:
And here is the page.php (maybe something in your page template has bad code and is causing the problem?
And here is the link to the source:
ThemeShaper
<form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p><input name="s" type="text" id="s" size="33" maxlength="99" />
<input type="submit" class="submit" value="Search »" /></p>
</form>
Then you can put this in your theme where you want the search input displayed (sidebar.php, header.php, or wherever):<?php include (TEMPLATEPATH . "/searchform.php"); ?>
Here is a nice coded search page accomponied with a good page.php template from ThemeShaper (also know as Automatic):
Here is the search.php:
And here is the page.php (maybe something in your page template has bad code and is causing the problem?
<?php if ( have_posts() ) : ?>
<h1 class="page-title"><?php _e( 'Search Results for: ', 'your-theme' ); ?><span><?php the_search_query(); ?></span></h1>
<?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
<div id="nav-above" class="navigation">
<div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">«</span> Older posts', 'your-theme' )) ?></div>
<div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">»</span>', 'your-theme' )) ?></div>
</div><!-- #nav-above -->
<?php } ?>
<?php while ( have_posts() ) : the_post() ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( __('Permalink to %s', 'your-theme'), the_title_attribute('echo=0') ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
<?php if ( $post->post_type == 'post' ) { ?>
<div class="entry-meta">
<span class="meta-prep meta-prep-author"><?php _e('By ', 'your-theme'); ?></span>
<span class="author vcard"><a class="url fn n" href="<?php echo get_author_link( false, $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( __( 'View all posts by %s', 'your-theme' ), $authordata->display_name ); ?>"><?php the_author(); ?></a></span>
<span class="meta-sep"> | </span>
<span class="meta-prep meta-prep-entry-date"><?php _e('Published ', 'your-theme'); ?></span>
<span class="entry-date"><abbr class="published" title="<?php the_time('Y-m-d\TH:i:sO') ?>"><?php the_time( get_option( 'date_format' ) ); ?></abbr></span>
<?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t" ) ?>
</div><!-- .entry-meta -->
<?php } ?>
<div class="entry-summary">
<?php the_excerpt( __( 'Continue reading <span class="meta-nav">»</span>', 'your-theme' ) ); ?>
<?php wp_link_pages('before=<div class="page-link">' . __( 'Pages:', 'your-theme' ) . '&after=</div>') ?>
</div><!-- .entry-summary -->
<?php if ( $post->post_type == 'post' ) { ?>
<div class="entry-utility">
<span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'your-theme' ); ?></span><?php echo get_the_category_list(', '); ?></span>
<span class="meta-sep"> | </span>
<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'your-theme' ) . '</span>', ", ", "</span>\n\t\t\t\t\t\t<span class=\"meta-sep\">|</span>\n" ) ?>
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'your-theme' ), __( '1 Comment', 'your-theme' ), __( '% Comments', 'your-theme' ) ) ?></span>
<?php edit_post_link( __( 'Edit', 'your-theme' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ) ?>
</div><!-- #entry-utility -->
<?php } ?>
</div><!-- #post-<?php the_ID(); ?> -->
<?php endwhile; ?>
<?php global $wp_query; $total_pages = $wp_query->max_num_pages; if ( $total_pages > 1 ) { ?>
<div id="nav-below" class="navigation">
<div class="nav-previous"><?php next_posts_link(__( '<span class="meta-nav">«</span> Older posts', 'your-theme' )) ?></div>
<div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">»</span>', 'your-theme' )) ?></div>
</div><!-- #nav-below -->
<?php } ?>
<?php else : ?>
<div id="post-0" class="post no-results not-found">
<h2 class="entry-title"><?php _e( 'Nothing Found', 'your-theme' ) ?></h2>
<div class="entry-content">
<p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'your-theme' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</div>
<?php endif; ?>
And here is the link to the source:
ThemeShaper
ASKER
when i used the search form above it didnt work, so i copied your search results page code and overwritten my code in my loop file. Still didnt fix it, so i assume the problem lies outside of the loop.php file
head scratching now
head scratching now
Did you fix it?
I was trying to diagnose your problem, and it is now working?
I was trying to diagnose your problem, and it is now working?
ASKER
I have removed the "search everything" plugin that was causing it - but now need a way to exclude a category and pages + including custom fields within my search, the plugin did a great job so gutted :(
You can give this a shot, it is from WP-Recipes
http://www.wprecipes.com/how-to-exclude-posts-or-pages-from-search-results
http://www.wprecipes.com/how-to-exclude-posts-or-pages-from-search-results
ASKER
I tried that with no success :(
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Appreciated your time and support