Skip to content

Instantly share code, notes, and snippets.

@FernE97
Created April 30, 2013 00:02
Show Gist options
  • Save FernE97/5485753 to your computer and use it in GitHub Desktop.
Save FernE97/5485753 to your computer and use it in GitHub Desktop.
PHP: WordPress Slides v2
<?php
$args = array(
'post_type' => 'slides', // custom post type
'orderby' => 'menu_order',
'posts_per_page' => -1
);
$slides = new WP_Query( $args );
if ( $slides->have_posts() ) : $count = 0; ?>
<ul class="slides">
<?php while ( $slides->have_posts() ) : $slides->the_post(); $count++; ?>
<li id="slide-<?php echo $count; ?>" class="slide">
<?php if ( has_post_thumbnail() ) the_post_thumbnail( 'slide' ); // custom thumbnail size ?>
<div class="slide-content">
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
</div>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment