I'm working on a Wordpress page using the Bootstrap framework. The normal search function works just fine, but if I search for spaces (" ") or words with a space in the beginning or end it totally messes up my navigation on the page - the html code is displayed on the site and I think the search function searches for values in my navigation.
I tried to solve this by creating the search.php and header.php as new but that didn't work. As I used Bootstrap to create the page I had some issues changing the code for the Wordpress templates and it's possible that there could be the cause.
HTML code from my header.php file:
<div id="searchBox" class="col-lg-2 col-lg-offset-4">
<div class="form-group">
<div class="icon-addon addon">
<form method="get" id="searchform" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input id="searchField" type="text" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" placeholder="Search..." class="form-control">
<label id="searchIcon" for="search" class="glyphicon glyphicon-search" rel="tooltip" title="Search..."></label>
</form>
</div>
</div>
</div>
Code from my search.php file:
<?php if (have_posts()) : ?>
<div class="row">
<content class="searchContent col-lg-7">
<div id="leftContent" class="col-lg-10 col-lg-offset-1 col-xs-12">
<?php while (have_posts()) : the_post(); ?>
<h1><a href="?php the_permalink()?"><?php the_title(); ?></a></h1>
<div class="entry">
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
<p align="center"><?php next_posts_link('« Ältere Einträge') ?> | <?php previous_posts_link('Neuere Einträge »') ?></p>
</div>
</content>
<aside class="col-lg-3">
<?php get_sidebar(); ?>
</aside>
</div>
<?php else : ?>
<div class="row">
<div id="siteTitle" class="col-lg-6 ">
<div id="titleText" class="info col-lg-offset-11">
<h1>Nothing found</h1>
</div>
</div>
Can you help me solve this issue? I tried for hours and days but haven't found a solution yet. Here an image of what my nav looks like if I search for values with spaces.