How to create custom search page and custom search Result page in WORDPRESS
Custom Search page
1. Create a new page into your theme (ex - customsearch.php )
2. Paste this code in your customsearch.php file
<form method="get" id="searchform" action="<?php bloginfo('home'); ?>/">
<div><input type="text" size="18" value="<?php echo wp_specialchars($s, 1); ?>" name="s" id="s" class="home_searchbox" />
<input type="submit" id="searchsubmit" value="Search" class="btn btn_home_search" />
</div>
</form>
and for advance searching add custom fields like this--
<form role="search" method="get" id="searchform" action="http://www.test.dev/">
<div>
<label for="s">Search for:</label>
<input type="text" value="" name="s" id="s" />
<input type="hidden" value="1" name="sentence" />
<input type="hidden" value="product" name="post_type" />
<input type="submit" id="searchsubmit" value="Search" />
</div>
</form>
Custom Search Result Page Or How to customize search result page in Wordpress
Copy the content.php page and if it is not exist in your theme then copy the content-search.php and paste this page as a new page ex(customcontent.php)
and then Inside the search.php file you’ll find a loop which includes this template tag:
get_template_part( 'content', get_post_format() );
Then change the above line of code to:
get_template_part( 'customsearch' );
now you can customize your customcontent.php as per your need.
THANK YOU.
WORDPRESS- How to create custom search page and custom search Results page in WORDPRESS Is Very Helpful. Thanks for such Information
ReplyDeleteLooking for WordPress Support Visit :
WordPress Support
WordPress Technical Support
WordPress Support Phone Number
Superb Information
ReplyDeleteWP Support
Superb Information
ReplyDeleteWP Support
This comment has been removed by the author.
ReplyDelete