Support » How-To and Troubleshooting » [Resolved] Search problems – Blank page

[Resolved] Search problems – Blank page

  • 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(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Search problems – Blank page’ is closed to new replies.
Skip to toolbar