Last active
August 31, 2016 17:15
-
-
Save WPDevHQ/92a830b5fc541f71dd5700757f95877d to your computer and use it in GitHub Desktop.
Generate a bxSlider from a Custom Post Type
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
<div class="bx-wrapper"> | |
<ul class="bxslider"> | |
<?php | |
$slider = new WP_Query(array( 'post_type' => 'homepage_slider' ) ); | |
if( $slider->have_posts() ) : | |
while($slider->have_posts()) : | |
$slider->the_post(); | |
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?> | |
<li class="featured-image" style="background-image: url('<?php echo $thumb['0'];?>')"> | |
<div class="slide-wrapper"> | |
<div class="slide-inner"> | |
<?php the_content() ?> | |
</div> | |
</div> | |
</li> | |
<?php | |
endwhile; | |
endif; | |
wp_reset_postdata(); | |
?> | |
</ul><!-- /.bxslider --> | |
</div><!-- /.bx-wrapper --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Not sure about the
div
s - maybe usespan
instead?