Work with custom search.php
-
I am creating my own theme and I am trying to get this plugin to work with it.
I’m not getting the search results I want and I guess the problem is in my
search.php.In my header I have a
get_search_form();and all results go to thesearch.php.This is the code I have in the
search.php. Is there anything I need to change there to make it work with this plugin?<?php $s=get_search_query(); $args = array('s' =>$s); // The Query $the_query = new WP_Query( $args ); if ( $the_query->have_posts() ) { _e("<h2>Search Results for: ".get_query_var('s')."</h2>"); while ( $the_query->have_posts() ) { $the_query->the_post(); ?> <li> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </li> <?php } } else { ?> <h2>Nothing Found</h2> <div> <p>Sorry, but nothing matched your search criteria. Please try again with some different keywords.</p> </div> <?php } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Work with custom search.php’ is closed to new replies.