Skip to content

Instantly share code, notes, and snippets.

@dryan1144
Created October 13, 2015 18:58
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 dryan1144/1846c18994c46e5911a2 to your computer and use it in GitHub Desktop.
Save dryan1144/1846c18994c46e5911a2 to your computer and use it in GitHub Desktop.
<?php //Slides loop
$args=array(
'post_type' => 'slide', //this is your cpt name
'post_status' => 'publish',
'posts_per_page' => -1, //this is the max number of slides
'orderby' => 'menu_order',
'order' => 'ASC'
);
$slide_query = new WP_Query($args);
if ($slide_query->have_posts()) :
echo '<ul class="slides">';
while ($slide_query->have_posts()) : $slide_query->the_post();
echo '<li>';
//this is where you add the image, your titles, other custom fields, etc
echo '</li>';
endwhile;
echo '</ul>';
endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment