• 1.
    <?php
  • 2.
        $metro_args = array();
  • 3.
        $metro_args['posts_per_page'] = 6;
  • 4.
        if(dw_get_theme_option('metro_order')) {
  • 5.
            $metro_args['orderby'] = dw_get_theme_option('metro_order');
  • 6.
            if($metro_args['orderby'] == 'title') {
  • 7.
                $metro_args['order'] = 'ASC';
  • 8.
            } else {
  • 9.
                $metro_args['order'] = 'DESC';
  • 10.
            }
  • 11.
        }
  • 12.
        $metro_cat = dw_get_theme_option('metro_cat');
  • 13.
        if( isset($metro_cat[0]) && $metro_cat[0] > 0 ) {
  • 14.
            $metro_args['category__in'] = $metro_cat;
  • 15.
        }
  • 16.
        $metro_tag = dw_get_theme_option('metro_tag');
  • 17.
        if( isset($metro_tag[0]) && $metro_tag[0] > 0 ) {
  • 18.
            $metro_args['tag__in'] = $metro_tag;
  • 19.
        }
  • 20.
        $metro_query = new WP_Query( $metro_args );
  • 21.
        if ( $metro_query->have_posts() ):
  • 22.
    ?>
  • 23.
     
  • 24.
    <div class="feature">
  • 25.
        <div id="dw-head-carousel" class="carousel slide">
  • 26.
            <!-- Carousel items -->
  • 27.
            <div class="carousel-inner">
  • 28.
                <?php
  • 29.
                $i = 0;
  • 30.
                while ( $metro_query->have_posts() ) : $metro_query->the_post();
  • 31.
                ?>
  • 32.
                <div class="<?php echo $i > 0 ? '' : 'active'; ?> item">
  • 33.
                    <?php if(has_post_thumbnail()) : ?>
  • 34.
                        <?php the_post_thumbnail('full'); ?>
  • 35.
                    <?php else : ?>
  • 36.
                        <img alt="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'designwall' ), the_title_attribute( 'echo=0' ) ) ); ?>" src="http://placehold.it/<?php echo $thumbnail_size.'x'.$thumbnail_size; ?>" />
  • 37.
                    <?php endif; ?>
  • 38.
     
  • 39.
                    <div class="inner gradient-black">
  • 40.
                        <p class="title">
  • 41.
                            <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'designwall' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
  • 42.
                        </p>
  • 43.
                        <div class="content"><?php the_excerpt(); ?> </div>
  • 44.
                    </div>
  • 45.
                </div>
  • 46.
                <?php $i++; ?>
  • 47.
                <?php endwhile;
  • 48.
     
  • 49.
                wp_reset_postdata();
  • 50.
                ?>
  • 51.
            </div>
  • 52.
     
  • 53.
            <ol class="carousel-indicators">
  • 54.
                <?php
  • 55.
                $i = 0;
  • 56.
                while ( $metro_query->have_posts() ) : $metro_query->the_post();
  • 57.
                ?>
  • 58.
                <li data-target="#dw-head-carousel" data-slide-to="<?php echo $i ?>" class="<?php echo $i > 0 ? '' : 'active'; ?>"></li>
  • 59.
                <?php $i ++; ?>
  • 60.
                <?php endwhile; ?>
  • 61.
            </ol>
  • 62.
     
  • 63.
            <!-- Carousel nav -->
  • 64.
            <a class="carousel-control left" href="#dw-head-carousel" data-slide="prev"><i class="icon-chevron-left"></i></a>
  • 65.
            <a class="carousel-control right" href="#dw-head-carousel" data-slide="next"><i class="icon-chevron-right"></i></a>
  • 66.
        </div>
  • 67.
    </div>
  • 68.
    <?php endif; ?>
<?php $metro_args = array(); $metro_args['posts_per_page'] = 6; if(dw_get_theme_option('metro_order')) { $metro_args['orderby'] = dw_get_theme_option('metro_order'); if($metro_args['orderby'] == 'title') { $metro_args['order'] = 'ASC'; } else { $metro_args['order'] = 'DESC'; } } $metro_cat = dw_get_theme_option('metro_cat'); if( isset($metro_cat[0]) && $metro_cat[0] > 0 ) { $metro_args['category__in'] = $metro_cat; } $metro_tag = dw_get_theme_option('metro_tag'); if( isset($metro_tag[0]) && $metro_tag[0] > 0 ) { $metro_args['tag__in'] = $metro_tag; } $metro_query = new WP_Query( $metro_args ); if ( $metro_query->have_posts() ): ?> <div class="feature"> <div id="dw-head-carousel" class="carousel slide"> <!-- Carousel items --> <div class="carousel-inner"> <?php $i = 0; while ( $metro_query->have_posts() ) : $metro_query->the_post(); ?> <div class="<?php echo $i > 0 ? '' : 'active'; ?> item"> <?php if(has_post_thumbnail()) : ?> <?php the_post_thumbnail('full'); ?> <?php else : ?> <img alt="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'designwall' ), the_title_attribute( 'echo=0' ) ) ); ?>" src="http://placehold.it/<?php echo $thumbnail_size.'x'.$thumbnail_size; ?>" /> <?php endif; ?> <div class="inner gradient-black"> <p class="title"> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'designwall' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a> </p> <div class="content"><?php the_excerpt(); ?> </div> </div> </div> <?php $i++; ?> <?php endwhile; wp_reset_postdata(); ?> </div> <ol class="carousel-indicators"> <?php $i = 0; while ( $metro_query->have_posts() ) : $metro_query->the_post(); ?> <li data-target="#dw-head-carousel" data-slide-to="<?php echo $i ?>" class="<?php echo $i > 0 ? '' : 'active'; ?>"></li> <?php $i ++; ?> <?php endwhile; ?> </ol> <!-- Carousel nav --> <a class="carousel-control left" href="#dw-head-carousel" data-slide="prev"><i class="icon-chevron-left"></i></a> <a class="carousel-control right" href="#dw-head-carousel" data-slide="next"><i class="icon-chevron-right"></i></a> </div> </div> <?php endif; ?>

Copy Code to Clipboard Raw

Sign-in or Create a Free Account.

Snippi uses Twitter or Facebook to register and create accounts. Registration will enable you to keep track of your snippets. We never spam your timeline or wall. Ever.

Sign-in with Facebook Sign-in with Twitter