Custom Search not Showing Results
-
Hello,
I’m having a bit of an issue displaying the results from my search page.So far I have created:
1. searchform.php (contains the search form)
<form action="<?php echo esc_url( home_url( '/') ); ?>" id="search-form" method="get"> <label for="s"></label> <input type="text" class="field" name="s" id="s" value="search" onblur="if(this.value=='')this.value='search'" onfocus"if(this.value=='search')this.value=''" /> <input type="hidden" value="submit" /> </form>
2. content-search.php (contains a copy of the themes index.php files, which is responsible for displaying all post types)
3. search.php
<?php get_header();?> <div id="preloader-container"> <div id="container"> <?php if ( have_posts() ) : ?> <div class="additional-content"> <h5 class="page-title"><?php printf( __( 'Search Results for: %s', 'adaptive-framework' ), get_search_query() ); ?></h5> </div> <?php while ( have_posts() ) : the_post(); ?> <?php get_template_part('content', 'search'); ?> <?php endwhile; ?> <?php else : ?> <article> <h1><?php _e('No results were found matching your criteria. Please try something else.', 'adaptive-framework'); ?></h1> </article> <?php endif; ?> </div> </div> <?php paginate_links(); ?> <?php get_footer(); ?>
When I search for something nothing is displayed. Any ideas of what I am doing wrong?
- The topic ‘Custom Search not Showing Results’ is closed to new replies.