Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.33 KB | None | 0 0
  1. <?php
  2.  
  3. global $block, $page_builder_id;
  4. $Cat_ID = $block['id'];
  5. $posts_num = 10;
  6. $style = $title ='';
  7.  
  8. if( !empty($block['title']) )
  9. $title = $block['title'];
  10.  
  11. if( !empty($block['style']) )
  12. $style = $block['style'];
  13.  
  14. if($style == 'row') $posts_num = 12;
  15.  
  16. $args = array(
  17. 'cat' => $Cat_ID,
  18. 'posts_per_page' => $posts_num,
  19. 'no_found_rows' => true,
  20. 'ignore_sticky_posts' => true
  21. );
  22.  
  23.  
  24. if( !empty($block['offset']) )
  25. $args['offset'] = $block['offset'];
  26.  
  27. $cat_query = new WP_Query( $args );
  28.  
  29. ?>
  30. <section class="cat-box pic-box tie-cat-<?php echo $Cat_ID ?> clear<?php if( $style == 'row' ) echo ' pic-grid'; ?>">
  31.  
  32. <?php if ( !empty( $title ) ) : ?>
  33. <div class="cat-box-title">
  34. <h2><a href="<?php echo get_category_link( $Cat_ID ); ?>"><?php if( function_exists('icl_t') ) echo icl_t( THEME_NAME , 'wpml-'.$page_builder_id.'-'.$block['boxid'] , $title); else echo $title ; ?></a></h2>
  35. <div class="stripe-line"></div>
  36. </div>
  37. <?php endif; ?>
  38.  
  39. <div class="cat-box-content">
  40.  
  41. <?php if($cat_query->have_posts()): $count=0; ?>
  42. <ul>
  43. <?php while ( $cat_query->have_posts() ) : $cat_query->the_post(); $count ++ ;?>
  44. <?php if($count == 1 && $style != 'row') : ?>
  45. <li <?php tie_post_class( 'first-pic' ); ?>>
  46. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
  47. <div class="post-thumbnail">
  48. <a href="<?php the_permalink(); ?>" class="ttip">
  49. <?php the_post_thumbnail( 'tie-large' ); ?>
  50. <span class="fa overlay-icon"></span>
  51. </a>
  52. </div><!-- post-thumbnail /-->
  53. <?php endif; ?>
  54. </li><!-- .first-pic -->
  55. <?php else: ?>
  56. <li <?php tie_post_class(); ?>>
  57. <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
  58. <div class="post-thumbnail">
  59. <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="ttip">
  60. <?php the_post_thumbnail( 'tie-small' ); ?>
  61. <span class="fa overlay-icon"></span>
  62. </a>
  63. </div><!-- post-thumbnail /-->
  64. <?php endif; ?>
  65. </li>
  66. <?php endif; ?>
  67. <?php endwhile;?>
  68. </ul>
  69. <div class="clear"></div>
  70. <?php endif; ?>
  71. </div><!-- .cat-box-content /-->
  72. </section>
  73.  
  74. <?php wp_reset_query(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement