• My search.php page is not displaying properly. If I keep the ‘get_header(); ?>’ in the search.php page, only the background is shown and the logo is partially displayed. If I remove ‘get_header(); ?>’, you can see the search results. This did not happen when I created the site in WP 3.7+. I guess in one of the updates, it no longer displays properly. All other pages display properly.

    Here is the header.php code”

    [ Moderator note: Code fixed, please wrap code in backticks or use the code button. The single quote does not work. ]

    <?php
    /**
     * The Header for our theme.
     *
     * @since Leaf 1.0
     */
    ?><!DOCTYPE html>
    <!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
    <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" <?php language_attributes(); ?>> <![endif]-->
    <!--[if IE 8]> <html class="no-js lt-ie9" <?php language_attributes(); ?>> <![endif]-->
    <!--[if gt IE 8]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]-->
    <head>
    <meta charset="<?php bloginfo( 'charset' ); ?>" />
    <meta name="viewport" content="width=device-width" />
    <title><?php wp_title( '|', true, 'right' ); ?></title>
    <link rel="profile" href="http://gmpg.org/xfn/11" />
    <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    
    <!-- IMPORTED LINKS -->
    
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/style.css" />
    <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_directory'); ?>/css/style-delta.css" />
    <link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/css/nivo-slider.css" type="text/css" media="screen" />
    <link rel="shortcut icon"  href="<?php bloginfo('stylesheet_directory'); ?>/img/favicon.ico" />
    
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/cufon-yui.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/Museo.font.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/Museo_Sans.font.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/supersized.3.1.3.core.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/superfish-compile.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery.nivo.slider.pack.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery.tinycarousel.min.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery.colorbox.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/jquery.tweet.js"></script>
    <script type="text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/text/javascript" src="<?php bloginfo('stylesheet_directory'); ?>/js/p2.js"></script>
    </head>
    <body>
    
    <!-- /FACEBOOK SCRIPT -->
    
    <div id="fb-root"></div>
    <script>(function(d, s, id) {
      var js, fjs = d.getElementsByTagName(s)[0];
      if (d.getElementById(id)) return;
      js = d.createElement(s); js.id = id;
      js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
      fjs.parentNode.insertBefore(js, fjs);
    }(document, 'script', 'facebook-jssdk'));</script>
    <!-- /END FACEBOOK SCRIPT -->
    
    <!-- /IMPORTED LINKS -->
    
    <!-- Begin wp_head() -->
    <?php wp_head(); ?>
    
    <!-- End wp_head() -->
    </head>
    
    <body <?php body_class(); ?>>
    
    <!-- Header begin-->
    
    <div id="container"> 
    
    			<div id="header" class="clearfix">
    			<div id="logo" > <a href="http://mspcpreschool.com/index.html"><img src="<?php bloginfo('stylesheet_directory'); ?>/img/logo.jpg" alt="logo" /></a> </div>
    
    			<!-- Navigation start -->
    			<ul class="sf-menu">
    
    <li> <a href="http://mspcpreschool.com/index.html">Home</a>
    			</li>
    <li><a href="http://mspcpreschool.com/about.html">About Us</a>
    <ul>
    <li> <a href="http://mspcpreschool.com/classes.html">Classes</a></li>
    <li> <a href="http://mspcpreschool.com/places.html">Places We Go</a></li>
    <li> <a href="http://mspcpreschool.com/director.html">Message from the Director</a></li>
    <li> <a href="http://mspcpreschool.com/contact.html">Contact Us</a></li>
    </ul>
    </li>
    <li> <a href="http://mspcpreschool.com/blog/category/activities/">Activities</a>
    <ul>
    <li> <a href="http://mspcpreschool.com/blog/calendar/">Calendar</a></li>
    <li> <a href="http://mspcpreschool.com/gallery.html">Gallery</a></li>
    </ul>
    </li>
    <li> <a href="#">Forms</a>
    <ul>
    <li> <a href="http://mspcpreschool.com/documents/parent_handbook.pdf">Parent Handbook</a></li>
    <li> <a href="http://mspcpreschool.com/documents/registration_form.pdf">Registration Form</a></li>
    <li>  <a href="http://mspcpreschool.com/documents/physical_form.pdf">Private Physicians Report Form</a></li>
    <li> <a href="http://mspcpreschool.com/documents/personal_history_form.pdf">Personal History Form</a></li>
    <li> <a href="http://mspcpreschool.com/documents/custody_form.pdf">Custody Form</a></li>
    <li> <a href="http://mspcpreschool.com/documents/emergency_form.pdf">Emergency Form</a></li>
    <li> <a href="http://mspcpreschool.com/documents/Snack_Suggestions.pdf">Snack Suggestions</a></li>
    <li>  <a href="http://mspcpreschool.com/documents/ESASD_2013_2014_School_Calendar.pdf">ESASD Calendar</a></li>
    </ul>
    </li>
    <li><a href="http://mspcpreschool.com/blog/">Our Blog</a></li>
    			<!-- Navigation end -->  
    
    </div>
    
    <!-- #head-container -->
    
    	<?php leaf_header_after(); // After Header hook. ?>
    
    	<div id="main" class="row">
    
     <p style="padding:10px">
    
    <div class="page_title round_6">
    				<h1 class="replace">Blog</h1>
    			</div>
    
    '
    
    Here is the current search.php code (I have removed get_header code temporarily until a solution can be found):
    
    '
    <?php
    global $query_string;
    
    $query_args = explode("&", $query_string);
    $search_query = array();
    
    foreach($query_args as $key => $string) {
    	$query_split = explode("=", $string);
    	$search_query[$query_split[0]] = urldecode($query_split[1]);
    } // foreach
    
    $search = new WP_Query($search_query);
    ?>
    
    <?php wp_head(); ?>
    
    	<section id="primary" class="site-content eight columns">
    		<div id="content" role="main">
    
    		<?php if ( have_posts() ) : ?>
    
    			<header class="page-header">
    				<h1 class="page-title"><?php printf( __( 'Search Results for: %s', 'leaf' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
    			</header>
    
    			<?php leaf_content_nav( 'nav-above' ); ?>
    
    			<?php /* Start the Loop */ ?>
    			<?php while ( have_posts() ) : the_post(); ?>
    				<?php get_template_part( 'content', get_post_format() ); ?>
    			<?php endwhile; ?>
    
    			<?php leaf_content_nav( 'nav-below' ); ?>
    
    		<?php else : ?>
    
    			<?php get_template_part( 'no-results', 'search' ); ?>
    
    		<?php endif; ?>
    
    		</div><!-- #content -->
    	</section><!-- #primary .site-content .eight .columns -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

Viewing 3 replies - 1 through 3 (of 3 total)
  • @erica2busy Restore the two original files (or hire someone who knows how to do what you want to achieve), and you’ll solve the problem.

    P.S.: The code you posted is a mess, they are two separate files merged together (?) and some piece seems to be missing.

    Thread Starter erica2busy

    (@erica2busy)

    The code I uploaded are 2 separate files – header.php and search.php. They are not merged together in their actual files (sorry this is my first post on wordpress.org)

    I have restored the original files and it does not work. What you see is a mixture of javascript and html in the code for me to customize wordpress – that is the reason you are finding things other than wordpress code.

    All of the pages work properly and as intended, but the search results page does not. It is the only page that does not work properly, and this is after an update.

    I use Leaf theme and WordPress 3.9.1 in a site of mine and I can assure you that there has never been any change in my search page results, the page displays correctly.
    As I said before you’ve made some customization and if you have customized other files (I hope you did it in a child theme) in a not appropriate way, this can be the cause of the issue.
    You should try to activate the original theme and if everything is fine then you have the evidence that the fault is of customization. Instead, if it still doesn’t display well (after having cleared cache) it’s possibly because of a plugin, so you should try to disable them all.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘search.php file affected by customized heaader’ is closed to new replies.