Advertisement
Guest User

Untitled

a guest
Jul 19th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.91 KB | None | 0 0
  1. <?php
  2. // Limit
  3. $limit = ( $stack['limit'] > 0 ) ? $stack['limit'] : -1;
  4.  
  5. // Exclude Category
  6. $exclude_category = ( isset( $stack['exclude_category'] ) ) ? $stack['exclude_category'] : array();
  7.  
  8. $categories = get_categories( array( 'exclude' => implode(',', $exclude_category) ) );
  9.  
  10. $args = array(
  11. 'post_type' => 'post',
  12. 'numberposts' => $limit,
  13. 'order' => 'DESC',
  14. 'orderby' => 'date',
  15. 'category__not_in' => $exclude_category,
  16. 'suppress_filters' => 0,
  17. );
  18. $posts = get_posts($args);
  19.  
  20. $slide_enable_bound = ( $stack['stack_desc'] != '' || $stack['button_text'] != '' ) ? 2 : 3;
  21. ?>
  22.  
  23. <div class="stack stack-blog <?php echo $element_style; ?>" id="<?php echo $stack['id']; ?>" style="<?php echo $stack_css; ?>">
  24. <div class="container">
  25. <div class="row">
  26.  
  27. <?php if( $stack['stack_title'] != '' ): ?><div class="title <?php echo (isset($stack['title_alignment']))?$stack['title_alignment']:''; ?>"><div class="title-wrap"><span><?php echo $stack['stack_title']; ?></span><div class="runner-line-grey"></div><div class="runner-line"></div></div></div><?php endif; ?>
  28.  
  29. <!-- Slide -->
  30. <?php if( $stack['style'] == 'slide' ): ?>
  31.  
  32. <?php if( $slide_enable_bound == 2 ): ?>
  33. <div class="col-md-4 info-box">
  34. <?php if( $stack['stack_desc'] ): ?>
  35. <p><?php echo $stack['stack_desc']; ?></p>
  36. <?php endif; ?>
  37.  
  38. <?php if( $stack['button_text'] ): ?>
  39. <p><a href="<?php echo do_shortcode( $stack['button_link'] ); ?>" class="nt-button"><?php echo do_shortcode( $stack['button_text'] ); ?></a></p>
  40. <?php endif; ?>
  41. </div>
  42. <?php endif; ?>
  43.  
  44. <?php if( $slide_enable_bound == 2 ): ?>
  45. <div class="col-md-8">
  46. <?php else: ?>
  47. <div class="col-md-12">
  48. <?php endif; ?>
  49.  
  50. <div class="row">
  51. <div class="nt-slider" data-items="<?php echo $slide_enable_bound; ?>" data-items-tablet="[1110,2]">
  52. <?php
  53. global $post;
  54. foreach ($posts as $post):
  55. setup_postdata($post);
  56.  
  57. if( has_post_format('gallery') ) {
  58. $icon = 'nt-icon-photo';
  59. } elseif ( has_post_format('audio') ) {
  60. $icon = 'nt-icon-music';
  61. } elseif ( has_post_format('video') ) {
  62. $icon = 'nt-icon-videocam';
  63. } elseif ( has_post_format('link') ) {
  64. $icon = 'nt-icon-globe';
  65. } else {
  66. $icon = 'nt-icon-doc';
  67. }
  68. ?>
  69. <div>
  70. <div class="carousel-item">
  71. <div class="nt-img-box show-border">
  72. <?php if(get_post_thumbnail_id()): ?>
  73. <a href="<?php the_permalink(); ?>" class="img-link">
  74. <?php
  75. echo nt_image(get_post_thumbnail_id(), 'nt-medium');
  76. ?>
  77. <i class="<?php echo $icon; ?> overlay-icon"></i>
  78. </a>
  79. <?php endif; ?>
  80. <div class="img-info">
  81. <p><a href="<?php the_permalink(); ?>"><strong>
  82. <?php
  83. if( strlen( get_the_title() ) > 50 ){
  84. echo substr(get_the_title(), 0, 50) . ' &hellip;';
  85. } else {
  86. the_title();
  87. }
  88. ?>
  89. </strong></a><br />
  90. <?php echo get_the_time(get_option('date_format')); ?>
  91. <p>
  92. <?php $excerpt = get_the_excerpt();
  93. if( strlen( $excerpt ) > 110 ){
  94. $excerpt = substr($excerpt, 0, 110) . ' &hellip;';
  95. }
  96. ?>
  97. <div class="secondary-info"><?php echo $excerpt; ?></div>
  98. </div>
  99. <a href="<?php the_permalink(); ?>"><span class="link-mask"></span></a>
  100. </div>
  101. </div>
  102. </div>
  103. <?php endforeach;
  104. wp_reset_postdata();
  105. ?>
  106. </div>
  107. </div><!-- .row -->
  108. </div><!-- .col-md-12 or .col-md-9 -->
  109.  
  110. <?php endif; ?>
  111.  
  112. <!-- Filter -->
  113. <?php if( $stack['style'] == 'filter' ): ?>
  114.  
  115.  
  116.  
  117. <div class="col-md-12 col-sm-12">
  118.  
  119. <div class="slide-control">
  120. <ul class="filter-button-list">
  121. <li><a href="#" class="filter-button active" data-filter="*"><?php _e('Show All', 'theme_front'); ?></a><span class="sep"></span></li>
  122. <?php foreach ($categories as $category): ?>
  123. <li><a href="#" class="filter-button" data-filter=".<?php echo $category->term_taxonomy_id; ?>"><?php echo $category->name; ?></a><span class="sep"></span></li>
  124. <?php endforeach; ?>
  125. </ul>
  126. </div>
  127.  
  128. <div class="row">
  129.  
  130. <div class="filter-wrap">
  131.  
  132. <?php
  133. global $post;
  134. foreach ($posts as $post):
  135. setup_postdata($post);
  136.  
  137. $post_categories_string = '';
  138. $post_categories = get_the_category();
  139. foreach ($post_categories as $post_category) {
  140. $post_categories_string .= $post_category->term_id . ' ';
  141. }
  142.  
  143. if( has_post_format('gallery') ) {
  144. $icon = 'nt-icon-photo';
  145. } elseif ( has_post_format('audio') ) {
  146. $icon = 'nt-icon-music';
  147. } elseif ( has_post_format('video') ) {
  148. $icon = 'nt-icon-videocam';
  149. } elseif ( has_post_format('link') ) {
  150. $icon = 'nt-icon-globe';
  151. } else {
  152. $icon = 'nt-icon-doc';
  153. }
  154. ?>
  155. <div class="col-md-4 col-sm-4 filter-item <?php echo $post_categories_string; ?>">
  156. <div class="nt-img-box show-border">
  157. <?php if(get_post_thumbnail_id()): ?>
  158. <a href="<?php the_permalink(); ?>" class="img-link">
  159. <?php
  160. echo nt_image(get_post_thumbnail_id(), 'nt-medium');
  161. ?>
  162. <i class="fa <?php echo $icon; ?> overlay-icon"></i>
  163. </a>
  164. <?php endif; ?>
  165. <div class="img-info">
  166. <p><a href="<?php the_permalink(); ?>"><strong>
  167. <?php
  168. if( strlen( get_the_title() ) > 50 ){
  169. echo substr(get_the_title(), 0, 50) . ' &hellip;';
  170. } else {
  171. the_title();
  172. }
  173. ?>
  174. </strong></a><br />
  175. <?php echo get_the_time(get_option('date_format')); ?>
  176. <p>
  177. <?php $excerpt = get_the_excerpt();
  178. if( strlen( $excerpt ) > 110 ){
  179. $excerpt = substr($excerpt, 0, 110) . ' &hellip;';
  180. }
  181. ?>
  182. <div class="secondary-info"><?php echo $excerpt; ?></div>
  183. </div>
  184. <a href="<?php the_permalink(); ?>"><span class="link-mask"></span></a>
  185. </div>
  186. </div>
  187. <?php endforeach;
  188. wp_reset_postdata();
  189. ?>
  190.  
  191. </div>
  192. </div>
  193. </div>
  194.  
  195. <?php endif; ?>
  196.  
  197. </div>
  198. </div>
  199. </div><!-- .stack-blog -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement