Created
November 28, 2016 18:02
-
-
Save chyngyz/ebc7f9c02181a9cd717761a38bc366d6 to your computer and use it in GitHub Desktop.
Wordpress Query by category slug
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'category_name' => 'slider' | |
); | |
$loop = new WP_Query( $args ); | |
if ( $loop->have_posts() ) : ?> | |
<div id="vgslider" class="vg__slider-wrap owl-carousel owl-theme"> | |
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?> | |
<?php if(has_post_thumbnail()) :?> | |
<div class="vg__slider vg__slider--1" style="background-image:url('<?php the_post_thumbnail_url( 'full' ); ?>')"> | |
<?php if( rwmb_meta( 'vg_url' ) ) :?> | |
<a href="<?php echo rwmb_meta( 'vg_url' ); ?>" class="vg__slider__more-btn"> | |
<?php echo rwmb_meta( 'vg_readmore' ); ?> | |
</a> | |
<?php endif; ?> | |
</div> | |
<?php else :?> | |
<?php endif;?> | |
<?php endwhile; ?> | |
</div><!-- #video-sidebar-right --> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment