Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ******************** Search box coding formate and search page all code ****************
- //Code your search box like is formate
- <form role="search" method="get" id="searchform" class="searchform" action="http://localhost/it-bari-wp/">
- <input type="text" value="" name="s" id="s">
- <input type="submit" id="searchsubmit" value="Search">
- </form>
- Note: <!--action url is website home page url -->
- **************************************************************************
- //Than Create a php file in your theme folder name > "searchform.php" and past bellow code here
- <!-- search -->
- <form class="search" method="get" action="<?php echo home_url(); ?>" role="search">
- <input class="search-input" type="search" name="s" placeholder="<?php _e( 'To search, type and hit enter.', 'html5blank' ); ?>">
- <button class="search-submit" type="submit" role="button"><?php _e( 'Search', 'html5blank' ); ?></button>
- </form>
- <!-- /search -->
- ***************************************************************************************
- //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.
- <section>
- <h1><?php echo sprintf( __( '%s Search Results for ', 'html5blank' ), $wp_query->found_posts ); echo get_search_query(); ?></h1>
- <?php get_template_part('post_loop'); ?> //this is for post loop
- <?php get_template_part('pagination'); ?> //this is for pagination
- </section>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement