Created
March 6, 2012 23:02
-
-
Save FernE97/1989620 to your computer and use it in GitHub Desktop.
PHP: WordPress Slides
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
<ul class="slides"> | |
<?php | |
$args = array( | |
'post_type' => 'slide', | |
'orderby' => 'menu_order', | |
'order' => 'ASC', | |
'posts_per_page' => 3 | |
); | |
$slides = get_posts( $args ); | |
$count = 0; | |
$slide_total = count( $slides ); | |
foreach ( $slides as $post ) { | |
$count++; | |
$image_thumb = wp_get_attachment_image( get_post_thumbnail_id( $post->ID ), 'slide' ); | |
?> | |
<li id="slide-<?php echo $count; ?>" class="slide"> | |
<?php echo $image_thumb; ?> | |
<div class="slide-content"> | |
<h2><?php echo $post->post_title; ?></h2> | |
<?php echo $post->post_content; ?> | |
</div> | |
<span class="slide-number"><?php echo $count, ' of ', $slide_total; ?></span> | |
</li> | |
<?php | |
} | |
?> | |
</ul><!-- /slides --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment