Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 402
  • Last Modified:

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
0
Andy6350
Asked:
Andy6350
  • 8
  • 5
1 Solution
 
jeremyjared74Commented:
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.
0
 
Andy6350Author Commented:
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,
0
 
jeremyjared74Commented:
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.
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
Andy6350Author Commented:
I have attached the loop.php file of my site.

Many Thanks, loop.php
0
 
gwkgCommented:
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.
0
 
Andy6350Author Commented:
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?

0
 
jeremyjared74Commented:
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
0
 
Andy6350Author Commented:
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
0
 
jeremyjared74Commented:
Did you fix it?

I was trying to diagnose your problem, and it is now working?
0
 
Andy6350Author Commented:
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 :(
0
 
jeremyjared74Commented:
You can give this a shot, it is from WP-Recipes
http://www.wprecipes.com/how-to-exclude-posts-or-pages-from-search-results
0
 
Andy6350Author Commented:
I tried that with no success :(
0
 
Andy6350Author Commented:
I found out the error occurs on the newer versions of the plugin, so i installed an older version and now it works fine
0
 
Andy6350Author Commented:
Appreciated your time and support
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now