Skip to content

Instantly share code, notes, and snippets.

@alisonmf
Created May 28, 2014 02:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alisonmf/1549f57493cbaf4201b2 to your computer and use it in GitHub Desktop.
Save alisonmf/1549f57493cbaf4201b2 to your computer and use it in GitHub Desktop.
PHP: simple WordPress slider w/ ACF
<section class="flexslider-sidebar">
<ul class="slides">
<?php $args=array(
'post_type' => 'platinum_logos',
'posts_per_page' => 4,
'orderby' => 'rand'
);
$my_query = null;
$my_query = new WP_Query($args);
if ( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
?>
<?php if ( has_post_thumbnail() ) { ?>
<li>
<a target="_blank" href="<?php the_field('website_address'); ?>">
<?php the_post_thumbnail(); ?>
</a>
</li>
<?php } ?>
<?php endwhile; } wp_reset_query(); ?>
</ul><!-- /.slides -->
</section><!-- /.flexslider -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment