Last active
September 1, 2018 18:48
-
-
Save shehabkhan013/3687a58bfc3b1def7a1b17889546a0c7 to your computer and use it in GitHub Desktop.
WordPress All Functionality for Search Form
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Put the Search Form Start*/ | |
<?php | |
if(is_search()){ | |
?> | |
<h3><?php _e("You searched for","alpha") ?>: <?php the_search_query(); ?></h3> | |
<?php | |
} | |
?> | |
<?php | |
echo get_search_form(); | |
?> | |
/* Put the Search Form End*/ | |
<?php get_header(); ?> | |
<body <?php body_class(); ?>> | |
<?php get_template_part( "/template-parts/common/hero" ); ?> | |
<div class="posts"> | |
<?php | |
/* Search Form Start*/ | |
if ( ! have_posts() ) { | |
?> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-12 text-center"> | |
<h4> | |
<?php _e('No result found','alpha'); ?> | |
</h4> | |
</div> | |
</div> | |
</div> | |
<?php | |
} | |
/* Search Form End*/ | |
/* This Code For Post*/ | |
while ( have_posts() ) { | |
the_post(); | |
get_template_part( "post-formats/content", get_post_format() ); | |
} | |
?> | |
<div class="container post-pagination"> | |
<div class="row"> | |
<div class="col-md-4"></div> | |
<div class="col-md-8"> | |
<?php | |
the_posts_pagination( array( | |
"screen_reader_text" => ' ', | |
"prev_text" => "New Posts", | |
"next_text" => "Old Posts" | |
) ); | |
?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<?php get_footer(); ?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form role="search" method="get" class="search-form" action="<?php echo home_url( '/' ); ?>"> | |
<label> | |
<span class="screen-reader-text"><?php echo _x( 'Search for:', 'label' ) ?></span> | |
<input type="search" class="search-field" placeholder="<?php echo esc_attr_x( 'Search …', 'placeholder' ) ?>" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x( 'Search for:', 'label' ) ?>" /> | |
</label> | |
<input type="submit" class="search-submit" | |
value="<?php echo esc_attr_x( 'Search', 'submit button' ) ?>" /> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment