Guest User

Untitled

a guest
Nov 19th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.48 KB | None | 0 0
  1. <?php
  2. $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;
  3. $args = array(
  4. 'post_type' => 'html5-blank',
  5. 'posts_per_page' => 5,
  6. 'paged' => $paged,
  7. 'category_name' => get_query_var('category_name')
  8. );
  9. ?>
  10. <?php $loop = new WP_Query( $args ); ?>
  11. <?php while ( $loop->have_posts() ) : $loop->the_post();
  12.  
  13. // current page number - paged is 0 on the home page, we use 1 instead
  14. $_current_page = is_paged() ? get_query_var( 'paged', 1 ) : 1;
  15.  
  16. // posts per page
  17. $_ppp = get_query_var( 'posts_per_page', get_option( 'posts_per_page' ) );
  18.  
  19. // current post index on the current page
  20. $_current_post = $loop->current_post;
  21.  
  22. // total number of found posts
  23. $_total_posts = $loop->found_posts;
  24. ?>
  25. <div class="col-xs-12 col-lg-10 col-lg-offset-1 video-short">
  26. <div class="row">
  27. <div class="video-short-img col-xs-5 col-lg-3 col-md-3">
  28. <a href="<?php the_permalink() ?>">
  29. <div class="featured-img featured-img-small" style="background-image: url(<?php echo wp_get_attachment_url( get_post_thumbnail_id() ); ?>);">
  30. <div class="video-blog-link">
  31. <span class="icon-View-Icon"></span>
  32. </div>
  33. </div>
  34. </a>
  35. </div>
  36. <div class="col-xs-7 col-lg-8 col-md-8 col-md-offset-1 video-short-body">
  37. <div class="video-short-headline">
  38. <h3 class="post-num"><?php echo $counter = $_total_posts - ( $_current_page - 1 ) * $_ppp - $_current_post; ?></h3>
  39. <a href="<?php the_permalink() ?>">
  40. <h4 class="post-headline text-uppercase"><?php the_title() ?></h4>
  41. </a>
  42. </div>
  43. <div class="post-body-short">
  44. <p><?php the_excerpt(); ?></p>
  45. <div class="video-short-tags-cats">
  46. <div class="subject">
  47. <p>
  48. <?php foreach ((get_the_category()) as $category) {
  49. echo $category->cat_name . ' ';
  50. } ?>
  51. </p>
  52. </div>
  53. <div class="tags">
  54. <p>
  55. <?php
  56. $posttags = get_the_tags();
  57. if ($posttags) {
  58. foreach($posttags as $tag) {
  59. echo $tag->name . ', ';
  60. }
  61. }
  62. ?>
  63. </p>
  64. </div>
  65. </div>
  66. </div>
  67. </div><!-- END video-short-body -->
  68. </div><!-- END row -->
  69. </div><!-- END VIDEO-SHORT -->
  70. <?php endwhile; ?>
  71.  
  72. <?php if ($loop->max_num_pages > 1) { // check if the max number of pages is greater than 1
  73. $nextUrl = get_next_posts_page_link();
  74. $prevUrl = get_previous_posts_page_link();
  75. ?>
  76. <div class="paginations clearfix">
  77. <ul class="pagination">
  78. <li><a href="<?php echo esc_url( $prevUrl ); ?>"><span class="icon-left_arrow"></span></a></li>
  79. <!-- pagination here -->
  80. <?php
  81. if (function_exists(custom_pagination)) {
  82. custom_pagination($loop->max_num_pages,"",$paged);
  83. }
  84. ?>
  85. <li><a href="<?php echo esc_url( $nextUrl ); ?>"><span class="icon-right_arrow"></span></a></li>
  86. </ul>
  87. </div>
  88. <?php } ?>
Add Comment
Please, Sign In to add comment