Get Post Thumbnails from X category to display in flexslider
-
Hey,
Hope someone can help with this. What I want is to display Post Thumbnails from a specific category in the flexslider.
I’m using the following code so far which gets all irfomation from a specific category posts, but the thumbnails does not appear as a slide.
<?php function add_flexslider() { // display attachment images as a flexslider gallery $attachments = get_children(array( 'numberposts' => 2, 'post_status'=>"publish", 'post_type'=>"post", 'category_name' => 'Destaque', // category slug ) ); if ($attachments) { // see if there are images attached to posting echo '<div class="flexslider">'; echo '<ul class="slides">'; foreach ( $attachments as $attachment_id => $attachment ) { // create the list items for images with captions echo '<li>'; echo wp_get_attachment_image_src( get_post_thumbnail_id($attachment->ID), 'full' ); echo '<p>'; echo get_post_field('post_excerpt', $attachment->ID); echo '</p>'; echo '</li>'; } echo '</ul>'; echo '</div>'; } // end see if images } // ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Get Post Thumbnails from X category to display in flexslider’ is closed to new replies.