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

  1. Flourt
    Posted 1 year 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' ); ?>">

    And in search.php:

    <?php get_header(); ?>
    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>
    			<?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
    							 foreach(get_the_category() as $category) {
    							     echo $category->cat_name . ' ';
    							 ?> </p>
    						<p class="post-desc">
    							<?php the_excerpt(); ?>
    						<p class="post-link"><?php _e('Voir l\'article'); ?></p>
    			<?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>
    			<?php } else{ ?>
    				<h1><?php _e('Aucun résultat n\'a été trouvé correspondant à vos critères.', 'starter-theme'); ?></h1>
    			<?php } ?>
    <?php get_footer(); ?>
  2. keesiemeijer
    Posted 1 year 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.

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

  3. Flourt
    Posted 1 year ago #

    Thank you very much it is a blunder of me.

Topic Closed

This topic has been closed to new replies.

About this Topic