I'm doing a WordPress theme, and I get stuck on one thing. As you know, the post-format in WordPress has different types of formats, I did all the types except the gallery slideshow. What I need, for example I had create one new post, and added gallery with pictures to this post, then I chose a gallery in post format. The problem, the gallery shows me all the images included in WordPress but I want to show only the post images.
Code:
if ( ! function_exists( 'flexi_gallery_slideshow' ) ) :
/**
* Display an optional post images. slideshow
*
*/
function flexi_gallery_slideshow( ){
echo '<ul class="bxslider" >';
$args = array(
'post_parent' =>$post->ID,
'post_type' => 'attachment',
'orderby' => 'menu_order', // you can also sort images by date or be name
'order' => 'ASC',
'numberposts' => 3, // number of. images (slides)
'post_mime_type' => 'image'
);
if ( $images = get_children( $args ) ) {
foreach( $images as $image ) {
echo '<li>';
echo wp_get_attachment_image($image->ID, array('640', '400') );
echo '</li>';
}
}
echo '</ul>';
}
endif;
$post
holds sane value at that point?