For anyone searching for this, Alchymth’s solution worked almost immediately. I had to remove my own mistake of the incorrect
<li>
tag. Beyond that, the only slightly strange thing was that the
<!-- Closing the class slide -->
added a <p> tag which cycle.js treated as another slide. Once removed it all worked perfectly.
Full code was
<?php
function l_carousel( $atts, $content = null ) {
$output = '';
$carousel_query = new WP_Query('post_type=carousel&showposts=10');
if ($carousel_query->have_posts()) :
$output .= '<div class="carousel">';
while ($carousel_query->have_posts()) : $carousel_query->the_post();
$output .= '<div class="slide">';
if(has_post_thumbnail())
{
$output .= get_the_post_thumbnail($post->ID,'featured_image');
} else {
$output .= '<img width="460" height="280" src="/image/placeholder.jpg" class="attachment-featured_image wp-post-image" alt="" />'; }
$output .= '</div>';
endwhile;
$output .= '</div>';
endif;
wp_reset_postdata();
return $output;
}
add_shortcode( 'carousel', 'l_carousel' ); ?>
Thanks to Alchymyth again!