PageRenderTime 78ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/templates/posts-pages.php

https://github.com/Sohag07Hasan/Hot-Destination-Search
PHP | 81 lines | 61 code | 20 blank | 0 comment | 12 complexity | c94a2e879494979f598034d9bdd7b53c MD5 | raw file
  1. <?php get_template_part('globals.php');?>
  2. <?php
  3. $NUMER_OF_POST_COLUMNS = 1;
  4. ?>
  5. <?php
  6. wp_reset_query();
  7. $wp_query = hot_wp_search::get_serach_posts_or_page();
  8. ?>
  9. <?php if ( have_posts() ) { ?>
  10. <h2 class="page-title">
  11. <?php if ( is_day() ) : ?>
  12. <?php printf( __( 'Daily Archives: %s', "hot_destinations" ), '<span>' . get_the_date() . '</span>' ); ?>
  13. <?php elseif ( is_month() ) : ?>
  14. <?php printf( __( 'Monthly Archives: %s', "hot_destinations" ), '<span>' . get_the_date( 'F Y' ) . '</span>' ); ?>
  15. <?php elseif ( is_year() ) : ?>
  16. <?php printf( __( 'Yearly Archives: %s', "hot_destinations" ), '<span>' . get_the_date( 'Y' ) . '</span>' ); ?>
  17. <?php else : ?>
  18. <?php _e( 'Blog Archives', "hot_destinations" ); ?>
  19. <?php endif; ?>
  20. </h2>
  21. <?php if ( $wp_query->max_num_pages > 1 ) { ?>
  22. <div class="clr"></div>
  23. <div id="nav-above" class="navigation">
  24. <div class="nav-previous" style="float:left;"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', "hot_destinations" ) ); ?></div>
  25. <div class="nav-next" style="float:right;"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', "hot_destinations" ) ); ?></div>
  26. </div>
  27. <div class="clr"></div>
  28. <?php } ?>
  29. <?php
  30. if(have_posts()){
  31. ?>
  32. <div class="blog">
  33. <?php
  34. global $hpost_class;
  35. $loop = 0;
  36. while ( have_posts() ) {
  37. the_post();
  38. $loop++;
  39. $hpost_class = 'column-'. ((($loop - 1) % $NUMER_OF_POST_COLUMNS) + 1);
  40. if(($loop - 1) % $NUMER_OF_POST_COLUMNS == 0){?>
  41. <div class="items-row cols-<?php echo $NUMER_OF_POST_COLUMNS;?> row-<?php echo floor($loop/$NUMER_OF_POST_COLUMNS);?>">
  42. <?php }
  43. get_template_part( 'content', get_post_format() );
  44. if(($loop - 1) % $NUMER_OF_POST_COLUMNS == $NUMER_OF_POST_COLUMNS - 1){?>
  45. </div>
  46. <span class="article_separator">&nbsp;</span>
  47. <?php }
  48. } ?>
  49. </div>
  50. <?php } ?>
  51. <?php if ( $wp_query->max_num_pages > 1 ) { ?>
  52. <div class="clr"></div>
  53. <div id="nav-below" class="navigation">
  54. <div class="nav-previous" style="float:left;"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', "hot_destinations" ) ); ?></div>
  55. <div class="nav-next" style="float:right;"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', "hot_destinations" ) ); ?></div>
  56. </div>
  57. <div class="clr"></div>
  58. <?php } ?>
  59. <?php } else { ?>
  60. <?php get_template_part( 'main-notfound' ); ?>
  61. <?php } ?>