Abdus Sattar Bhuiyan
Abdus Sattar Bhuiyan

Reputation: 3074

Search result template is not working

As wordpress page template hierarchy search.php is the page template to show search result. But I can't see the search result in search.php template file.Here is the search form:

<?php  get_search_form(); ?>

content of searchform.php:

<form action="<?php echo home_url( '/' ).'/search'; ?>" method="get" class="form-inline my-2 my-lg-0">
    <input class="search-box form-control border-secondary py-2" type="search" name="s" placeholder="Ask Your Question Here...">  
</form>

search.php:

search.php page

I should see search.php page when I search. but I can't see this. Whats wrong in my approach?

Upvotes: 0

Views: 69

Answers (1)

Owi
Owi

Reputation: 498

You are sending the data to /search but there is no handler for your form

Please try changing your snippet to something like:

<form action="<?php echo home_url( '/' ); ?>" method="get" class="form-inline my-2 my-lg-0">
    <input class="search-box form-control border-secondary py-2" type="search" name="s" placeholder="Ask Your Question Here...">  
</form>

Upvotes: 1

Related Questions