WordPress.org

Forums

[resolved] Search problems - Blank page (3 posts)

  1. Flourt
    Member
    Posted 9 months ago #

    I apologize right now for my bad english because I'm french.

    I am trying to develop a theme for WordPress but the search results page is not accessible: the page is blank.

    I do not understand why...

    You can find this error on the website: http://fantassin.fr/starter/demo/

    Here is the code in searchform.php:

    <form role="search" id="searchform" method="get" class="search-form small-12" action="<?php bloginfo('home'); ?>">
    	<label class="screen-reader-text form-label" for="s"><?php _e( 'Saisissez votre recherche', 'starter-theme' ); ?></label>
    	<input type="text" class="form-input" value="<?php get_search_query(); ?>" name="s" id="s" placeholder="Ma recherche">
    	<input type="reset" class="form-reset" value="<?php _e( 'Annuler', 'starter-theme' ); ?>">
    	<input type="submit" id="searchsubmit" class="form-submit" value="<?php _e( 'Rechercher', 'starter-theme' ); ?>">
    </form>

    And in search.php:

    <?php get_header(); ?>
    
    <?php
    global $wp_query;
    $total_results = $wp_query->found_posts;
    ?>
    
    <section class="content">
    	<section class="wrap">
    		<div class="content-page">
    
    			<?php if (have_posts()) { ?>
    
    			<div class="content-header">
    				<h1>“<?php the_search_query(); ?>” <small><?php echo _n( '%d résultat pour votre recherche.', '%d résultats pour votre recherche.', $total_results, 'starter-theme' ); ?></small></h1>
    			</div>
    
    			<?php while ( have_posts() ) { the_post(); ?>
    
    			<a class="content-link" href="<?php the_permalink(); ?>">
    				<article <?php post_class("row"); ?>>
    					<div class="large-12 medium-12 small-12">
    						<h2 class="post-title"><?php the_title(); ?></h2>
    						<p class="post-meta">Le <?php the_time('j/m/Y'); ?> par <?php the_author(); ?> dans
    							 <?php
    							 foreach(get_the_category() as $category) {
    							     echo $category->cat_name . ' ';
    							 }
    							 ?> </p>
    						<p class="post-desc">
    							<?php the_excerpt(); ?>
    						</p>
    						<p class="post-link"><?php _e('Voir l\'article'); ?></p>
    					</div>
    				</article>
    			</a>
    
    			<?php }	?>
    
    			<ul class="pagination">
    				<li><?php previous_posts_link(__('Précédent', 'starter-theme')); ?></li>
    				<?php pagination(); ?>
    				<li><?php next_posts_link(__('Suivant', 'starter-theme')); ?></li>
    			</ul>
    
    			<?php } else{ ?>
    
    				<h1><?php _e('Aucun résultat n\'a été trouvé correspondant à vos critères.', 'starter-theme'); ?></h1>
    
    			<?php } ?>
    
    		</div>
    	</section>
    </section>
    
    <?php get_footer(); ?>
  2. keesiemeijer
    moderator
    Posted 9 months ago #

    Hi Flourt

    In your stylesheet style.css you have this:

    .search {
        background-color: rgba(255, 255, 255, 0.96);
        bottom: 0;
        display: none;
        left: 0;
        line-height: 1.45;
        position: fixed;
        right: 0;
        top: 0;
        z-index: 9999;
    }

    Notice the display: none;
    The body class is also adding the 'search' class to the body.
    http://codex.wordpress.org/Function_Reference/body_class

    Did you add this css rule for another element on the page?

  3. Flourt
    Member
    Posted 9 months ago #

    Thank you very much it is a blunder of me.

Reply

You must log in to post.

About this Topic