Link to home
Start Free TrialLog in
Avatar of Andy6350
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
Avatar of jeremyjared74
jeremyjared74
Flag of United States of America image

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.
Avatar of Andy6350
Andy6350

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,
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.
I have attached the loop.php file of my site.

Many Thanks, loop.php
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.
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:
<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 &raquo;" /></p>
</form>

Open in new window

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"); ?>

Open in new window


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">&laquo;</span> Older posts', 'your-theme' )) ?></div>
                    <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</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">&raquo;</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">&laquo;</span> Older posts', 'your-theme' )) ?></div>
                    <div class="nav-next"><?php previous_posts_link(__( 'Newer posts <span class="meta-nav">&raquo;</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; ?>

Open in new window


And here is the link to the source:
ThemeShaper
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
Did you fix it?

I was trying to diagnose your problem, and it is now working?
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 :(
I tried that with no success :(
ASKER CERTIFIED SOLUTION
Avatar of Andy6350
Andy6350

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Appreciated your time and support