search.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * The template for displaying search results pages.
  4. *
  5. * @package WordPress
  6. * @subpackage Taskereasy
  7. * @since Taskereasy 1.0
  8. */
  9. get_header();
  10. taskereasy_blog_banner();
  11. ?>
  12. <div id="primary" class="content-area">
  13. <main id="main" class="site-main">
  14. <div class="container">
  15. <div class="section-padding">
  16. <?php if ( have_posts() ) : ?>
  17. <header class="page-header">
  18. <h3 class="page-title"><?php printf( esc_html__( 'Search Results for: %s', 'taskereasy' ), get_search_query() ); ?></h3>
  19. </header><!-- .page-header -->
  20. <div class="row">
  21. <?php
  22. // Start the loop.
  23. while ( have_posts() ) : the_post(); ?>
  24. <div class="col-md-6">
  25. <article <?php post_class('post-container grid-style'); ?>>
  26. <?php if(has_post_thumbnail()){ ?>
  27. <div class="post-thumbnail">
  28. <a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>
  29. </div>
  30. <?php } ?>
  31. <div class="post-meta">
  32. <ul>
  33. <li><?php echo esc_html__('By:', 'taskereasy') ?> <a href="<?php echo get_author_posts_url(get_the_author_meta('ID')); ?>"><?php the_author(); ?></a></li>
  34. <li><a href="<?php the_permalink(); ?>"><?php echo get_the_date(); ?></a></li>
  35. <?php the_category(); ?>
  36. </ul>
  37. </div>
  38. <h2 class="post-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  39. <div class="excerpt"><?php echo taskereasy_custom_excerpt_length(19); ?></div>
  40. <a href="<?php the_permalink(); ?>" class="btn"><?php echo esc_html__ ('Read More', 'taskereasy'); ?> <i class="fa fa-angle-right"></i></a>
  41. </article>
  42. </div>
  43. <?php
  44. // End the loop.
  45. endwhile; ?>
  46. <?php // Previous/next page navigation.
  47. the_posts_pagination( array(
  48. 'prev_text' => esc_html__( 'Previous page', 'taskereasy' ),
  49. 'next_text' => esc_html__( 'Next page', 'taskereasy' ),
  50. 'before_page_number' => '<span class="meta-nav screen-reader-text">' . esc_html__( 'Page', 'taskereasy' ) . ' </span>',
  51. ) );
  52. // If no content, include the "No posts found" template.
  53. else :
  54. get_template_part( 'template-parts/post/content', 'none' );
  55. endif;
  56. ?>
  57. </div>
  58. </div>
  59. </div>
  60. </main><!-- .site-main -->
  61. </div><!-- .content-area -->
  62. <?php get_footer(); ?>