Advertisement
shakil97bd

Search box coding formate and search page all code for wp

Feb 3rd, 2015
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.54 KB | None | 0 0
  1. ******************** Search box coding formate and search page all code ****************
  2.  
  3. //Code your search box like is formate
  4.  
  5.  
  6.             <form role="search" method="get" id="searchform" class="searchform" action="http://localhost/it-bari-wp/">
  7.                 <input type="text" value="" name="s" id="s">
  8.                 <input type="submit" id="searchsubmit" value="Search">
  9.             </form>
  10.  
  11. Note: <!--action url is website home page url -->
  12. **************************************************************************                     
  13.  
  14.  
  15. //Than Create a php file in your theme folder name > "searchform.php" and past bellow code here
  16.  
  17.    
  18. <!-- search -->
  19. <form class="search" method="get" action="<?php echo home_url(); ?>" role="search">
  20.     <input class="search-input" type="search" name="s" placeholder="<?php _e( 'To search, type and hit enter.', 'html5blank' ); ?>">
  21.     <button class="search-submit" type="submit" role="button"><?php _e( 'Search', 'html5blank' ); ?></button>
  22. </form>
  23. <!-- /search -->
  24.        
  25.            
  26.     ***************************************************************************************    
  27.            
  28. //Than Create another php file in your theme folder(copy a page or single template and rename it into search.php) name "search.php" and past bellow code where you want to show search result.
  29.  
  30.  
  31. <section>  
  32.     <h1><?php echo sprintf( __( '%s Search Results for ', 'html5blank' ), $wp_query->found_posts ); echo get_search_query(); ?></h1>
  33.  
  34.     <?php get_template_part('post_loop'); ?>    //this is for post loop
  35.     <?php get_template_part('pagination'); ?>   //this is for pagination
  36. </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement