Created
October 6, 2012 20:19
-
-
Save JLeuze/3845991 to your computer and use it in GitHub Desktop.
Get a linked list of slide post titles for Meteor 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
<?php | |
/* Loop template for the slide posts list */ | |
// Settings for slide list loop | |
global $post; | |
$meteor_posttemp = $post; | |
$meteor_count = 1; | |
$meteor_loop = new WP_Query( array( | |
'post_type' => 'slide', // Just gets the slide posts | |
'order' => 'ASC', // Sorts them A-Z | |
'orderby' => 'title', // Orders slide posts alphabetically by title | |
// 'slideshow' => 'robots', // Load a specific slideshow | |
'posts_per_page' => 5 // Quantity of slide posts to get | |
) ); ?> | |
<?php // Check for slides | |
if ( $meteor_loop->have_posts() ) : ?> | |
<ul id="meteor-slides-list"> | |
<?php // Loop which loads the slide list | |
while ( $meteor_loop->have_posts() ) : $meteor_loop->the_post(); ?> | |
<li class="mslide-post mslide-post-<?php echo $meteor_count; ?>"><?php | |
// Adds slide title with Slide URL link | |
if ( get_post_meta( $post->ID, "slide_url_value", $single = true ) != "" ): | |
?><a href="<?php echo get_post_meta( $post->ID, "slide_url_value", $single = true ); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a><?php | |
// Adds slide link without Slide URL link | |
else: | |
the_title(); | |
endif; | |
?></li><!-- .mslide-post --> | |
<?php $meteor_count++; ?> | |
<?php endwhile; ?> | |
<?php // Reset the slide list loop | |
$post = $meteor_posttemp; | |
wp_reset_postdata(); ?> | |
</ul><!-- #meteor-slides-list --> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment