Created
November 15, 2012 20:44
-
-
Save dannymichel/4081141 to your computer and use it in GitHub Desktop.
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 | |
global $post; | |
$placeholder_args = array( 'post_type' => 'slides', 'posts_per_page'=>1 ); | |
$loop_slides_placeholder = new WP_Query( $placeholder_args ); | |
if ( $loop_slides_placeholder->have_posts() ) : $postCount = 1; while ( $loop_slides_placeholder->have_posts() ) : $postCount++; ?> | |
<div <?php if($postCount == 1) { ?>id="featured_placeholder"<?php } else { ?>class="featured"<?php } ?> > | |
<?php endwhile; endif; ?> | |
<?php | |
$args = array( 'post_type' => 'slides', 'posts_per_page'=>9999 ); | |
$loop_slides = new WP_Query( $args ); | |
while ( $loop_slides->have_posts() ) : $loop_slides->the_post(); | |
$postid = get_the_ID(); | |
if(has_excerpt()) { | |
$datacaption = 'data-caption="#slide-'.$postid.'"'; | |
} else { | |
$datacaption = ''; | |
} | |
if(has_post_thumbnail()) { | |
$urlbox = get_url_desc_box(); | |
$urlcolor = get_color_desc_box(); | |
$imgid = get_post_thumbnail_id($postid); | |
$alt = get_post_meta($imgid , '_wp_attachment_image_alt', true); | |
$imgurl = wp_get_attachment_image_src( $imgid, 'home_slider' ); | |
echo '<img class="lazy orbit-slide" src="'.$imgurl[0].'" '.$datacaption.' alt="'.$alt.'" />'; | |
} else { | |
echo '<div class="orbit-slide" '.$datacaption.'>'; | |
echo get_the_content(); | |
echo '</div>'; | |
} | |
if(has_excerpt()) { | |
$output = '<span class="orbit-caption" id="slide-'.get_the_ID().'">'; | |
$output .= '<span>'.'<a class="slide_place_holder '.$urlcolor[0].'" href="'. $urlbox[0] .'" title="'. get_the_title() .'">'. '<span class="slider_title">'.get_the_title() .'</span>'. '</a>'.'</span><span class="slide_excerpt">'. get_the_excerpt().'</span>'; | |
$output .= '</span>'; | |
echo $output; | |
} | |
endwhile; | |
?> | |
</div> | |
<?php wp_reset_query(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment