blog-grid.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <!-- Main Container -->
  2. <div class="main-container">
  3. <?php
  4. // Category Description
  5. if ( is_category() ) {
  6. get_template_part( 'templates/grid/category', 'description' );
  7. }
  8. // Blog Grid
  9. echo '<ul class="blog-grid">';
  10. if ( have_posts() ) :
  11. // Loop Start
  12. while ( have_posts() ) :
  13. the_post();
  14. // if is preview (boat post)
  15. if ( ! ( ashe_is_preview() && get_the_ID() == 19 ) ) :
  16. echo '<li>';
  17. ?>
  18. <article id="post-<?php the_ID(); ?>" <?php post_class('blog-post'); ?>>
  19. <div class="post-media">
  20. <a href="<?php echo esc_url( get_permalink() ); ?>"></a>
  21. <?php the_post_thumbnail('ashe-full-thumbnail'); ?>
  22. </div>
  23. <header class="post-header">
  24. <?php
  25. $category_list = get_the_category_list( ',&nbsp;&nbsp;' );
  26. if ( ashe_options( 'blog_page_show_categories' ) === true && $category_list ) {
  27. echo '<div class="post-categories">' . $category_list . ' </div>';
  28. }
  29. ?>
  30. <?php if ( get_the_title() ) : ?>
  31. <h2 class="post-title">
  32. <a href="<?php esc_url( the_permalink() ); ?>"><?php the_title(); ?></a>
  33. </h2>
  34. <?php endif; ?>
  35. <?php if ( ashe_options( 'blog_page_show_date' ) || ashe_options( 'blog_page_show_comments' ) ) : ?>
  36. <div class="post-meta clear-fix">
  37. <?php if ( ashe_options( 'blog_page_show_date' ) === true ) : ?>
  38. <span class="post-date"><?php the_time( get_option( 'date_format' ) ); ?></span>
  39. <?php endif; ?>
  40. <span class="meta-sep">/</span>
  41. <?php
  42. if ( ashe_post_sharing_check() && ashe_options( 'blog_page_show_comments' ) === true ) {
  43. comments_popup_link( esc_html__( '0 Comments', 'ashe' ), esc_html__( '1 Comment', 'ashe' ), '% '. esc_html__( 'Comments', 'ashe' ), 'post-comments');
  44. }
  45. ?>
  46. </div>
  47. <?php endif; ?>
  48. </header>
  49. <?php if ( ashe_options( 'blog_page_post_description' ) !== 'none' ) : ?>
  50. <div class="post-content">
  51. <?php
  52. $linkText = 'Read More';
  53. if ( ashe_options( 'blog_page_post_description' ) === 'content' ) {
  54. if ( get_query_var( 'paged', 0 ) == 0 && $wp_query->current_post == 0 ) {
  55. the_content('');
  56. $linkText = 'Permalink';
  57. } else {
  58. ashe_excerpt( 110 );
  59. }
  60. } elseif ( ashe_options( 'blog_page_post_description' ) === 'excerpt' ) {
  61. ashe_excerpt( 110 );
  62. }
  63. ?>
  64. </div>
  65. <?php endif; ?>
  66. <div class="read-more">
  67. <a href="<?php echo esc_url( get_permalink() ); ?>"><?php esc_html_e( $linkText,'ashe' ); ?></a>
  68. </div>
  69. <footer class="post-footer">
  70. <?php if ( ashe_options( 'blog_page_show_author' ) === true ) : ?>
  71. <span class="post-author">
  72. <a href="<?php echo esc_url(get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) )); ?>">
  73. <?php echo get_avatar( get_the_author_meta( 'ID' ), 30 ); ?>
  74. </a>
  75. <?php the_author_posts_link(); ?>
  76. </span>
  77. <?php endif; ?>
  78. <?php
  79. if ( ashe_post_sharing_check() ) {
  80. ashe_post_sharing();
  81. } else if ( ashe_options( 'blog_page_show_comments' ) === true ) {
  82. comments_popup_link( esc_html__( '0 Comments', 'ashe' ), esc_html__( '1 Comment', 'ashe' ), '% '. esc_html__( 'Comments', 'ashe' ), 'post-comments');
  83. }
  84. ?>
  85. </footer>
  86. <!-- Related Posts -->
  87. <?php ashe_related_posts( esc_html__( 'You May Also Like','ashe' ), ashe_options( 'blog_page_related_orderby' ) ); ?>
  88. </article>
  89. <?php
  90. echo '</li>';
  91. endif;
  92. endwhile; // Loop End
  93. else:
  94. ?>
  95. <div class="no-result-found">
  96. <h3><?php esc_html_e( 'Nothing Found!', 'ashe' ); ?></h3>
  97. <p><?php esc_html_e( 'Sorry, but nothing matched your search terms. Please try again with some different keywords.', 'ashe' ); ?></p>
  98. <div class="ashe-widget widget_search">
  99. <?php get_search_form(); ?>
  100. </div>
  101. </div>
  102. <?php
  103. endif; // have_posts()
  104. echo '</ul>';
  105. ?>
  106. <?php get_template_part( 'templates/grid/blog', 'pagination' ); ?>
  107. </div><!-- .main-container -->