Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Limit
- $limit = ( $stack['limit'] > 0 ) ? $stack['limit'] : -1;
- // Exclude Category
- $exclude_category = ( isset( $stack['exclude_category'] ) ) ? $stack['exclude_category'] : array();
- $categories = get_categories( array( 'exclude' => implode(',', $exclude_category) ) );
- $args = array(
- 'post_type' => 'post',
- 'numberposts' => $limit,
- 'order' => 'DESC',
- 'orderby' => 'date',
- 'category__not_in' => $exclude_category,
- 'suppress_filters' => 0,
- );
- $posts = get_posts($args);
- $slide_enable_bound = ( $stack['stack_desc'] != '' || $stack['button_text'] != '' ) ? 2 : 3;
- ?>
- <div class="stack stack-blog <?php echo $element_style; ?>" id="<?php echo $stack['id']; ?>" style="<?php echo $stack_css; ?>">
- <div class="container">
- <div class="row">
- <?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; ?>
- <!-- Slide -->
- <?php if( $stack['style'] == 'slide' ): ?>
- <?php if( $slide_enable_bound == 2 ): ?>
- <div class="col-md-4 info-box">
- <?php if( $stack['stack_desc'] ): ?>
- <p><?php echo $stack['stack_desc']; ?></p>
- <?php endif; ?>
- <?php if( $stack['button_text'] ): ?>
- <p><a href="<?php echo do_shortcode( $stack['button_link'] ); ?>" class="nt-button"><?php echo do_shortcode( $stack['button_text'] ); ?></a></p>
- <?php endif; ?>
- </div>
- <?php endif; ?>
- <?php if( $slide_enable_bound == 2 ): ?>
- <div class="col-md-8">
- <?php else: ?>
- <div class="col-md-12">
- <?php endif; ?>
- <div class="row">
- <div class="nt-slider" data-items="<?php echo $slide_enable_bound; ?>" data-items-tablet="[1110,2]">
- <?php
- global $post;
- foreach ($posts as $post):
- setup_postdata($post);
- if( has_post_format('gallery') ) {
- $icon = 'nt-icon-photo';
- } elseif ( has_post_format('audio') ) {
- $icon = 'nt-icon-music';
- } elseif ( has_post_format('video') ) {
- $icon = 'nt-icon-videocam';
- } elseif ( has_post_format('link') ) {
- $icon = 'nt-icon-globe';
- } else {
- $icon = 'nt-icon-doc';
- }
- ?>
- <div>
- <div class="carousel-item">
- <div class="nt-img-box show-border">
- <?php if(get_post_thumbnail_id()): ?>
- <a href="<?php the_permalink(); ?>" class="img-link">
- <?php
- echo nt_image(get_post_thumbnail_id(), 'nt-medium');
- ?>
- <i class="<?php echo $icon; ?> overlay-icon"></i>
- </a>
- <?php endif; ?>
- <div class="img-info">
- <p><a href="<?php the_permalink(); ?>"><strong>
- <?php
- if( strlen( get_the_title() ) > 50 ){
- echo substr(get_the_title(), 0, 50) . ' …';
- } else {
- the_title();
- }
- ?>
- </strong></a><br />
- <?php echo get_the_time(get_option('date_format')); ?>
- <p>
- <?php $excerpt = get_the_excerpt();
- if( strlen( $excerpt ) > 110 ){
- $excerpt = substr($excerpt, 0, 110) . ' …';
- }
- ?>
- <div class="secondary-info"><?php echo $excerpt; ?></div>
- </div>
- <a href="<?php the_permalink(); ?>"><span class="link-mask"></span></a>
- </div>
- </div>
- </div>
- <?php endforeach;
- wp_reset_postdata();
- ?>
- </div>
- </div><!-- .row -->
- </div><!-- .col-md-12 or .col-md-9 -->
- <?php endif; ?>
- <!-- Filter -->
- <?php if( $stack['style'] == 'filter' ): ?>
- <div class="col-md-12 col-sm-12">
- <div class="slide-control">
- <ul class="filter-button-list">
- <li><a href="#" class="filter-button active" data-filter="*"><?php _e('Show All', 'theme_front'); ?></a><span class="sep"></span></li>
- <?php foreach ($categories as $category): ?>
- <li><a href="#" class="filter-button" data-filter=".<?php echo $category->term_taxonomy_id; ?>"><?php echo $category->name; ?></a><span class="sep"></span></li>
- <?php endforeach; ?>
- </ul>
- </div>
- <div class="row">
- <div class="filter-wrap">
- <?php
- global $post;
- foreach ($posts as $post):
- setup_postdata($post);
- $post_categories_string = '';
- $post_categories = get_the_category();
- foreach ($post_categories as $post_category) {
- $post_categories_string .= $post_category->term_id . ' ';
- }
- if( has_post_format('gallery') ) {
- $icon = 'nt-icon-photo';
- } elseif ( has_post_format('audio') ) {
- $icon = 'nt-icon-music';
- } elseif ( has_post_format('video') ) {
- $icon = 'nt-icon-videocam';
- } elseif ( has_post_format('link') ) {
- $icon = 'nt-icon-globe';
- } else {
- $icon = 'nt-icon-doc';
- }
- ?>
- <div class="col-md-4 col-sm-4 filter-item <?php echo $post_categories_string; ?>">
- <div class="nt-img-box show-border">
- <?php if(get_post_thumbnail_id()): ?>
- <a href="<?php the_permalink(); ?>" class="img-link">
- <?php
- echo nt_image(get_post_thumbnail_id(), 'nt-medium');
- ?>
- <i class="fa <?php echo $icon; ?> overlay-icon"></i>
- </a>
- <?php endif; ?>
- <div class="img-info">
- <p><a href="<?php the_permalink(); ?>"><strong>
- <?php
- if( strlen( get_the_title() ) > 50 ){
- echo substr(get_the_title(), 0, 50) . ' …';
- } else {
- the_title();
- }
- ?>
- </strong></a><br />
- <?php echo get_the_time(get_option('date_format')); ?>
- <p>
- <?php $excerpt = get_the_excerpt();
- if( strlen( $excerpt ) > 110 ){
- $excerpt = substr($excerpt, 0, 110) . ' …';
- }
- ?>
- <div class="secondary-info"><?php echo $excerpt; ?></div>
- </div>
- <a href="<?php the_permalink(); ?>"><span class="link-mask"></span></a>
- </div>
- </div>
- <?php endforeach;
- wp_reset_postdata();
- ?>
- </div>
- </div>
- </div>
- <?php endif; ?>
- </div>
- </div>
- </div><!-- .stack-blog -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement