Currently, the code below runs well if I use the old gallery shortcode that looks like this [gallery]
. However, after Wordpress 3.5 update gallery shortcodes now include the image IDs by default that looks like [gallery ids="766,765,764,763,762,761"]
.
The new shortcode with ids prevents the gallery to show. What should I do to make it compatible? Its not showing anything if I used [gallery ids="766,765,764,763,762,761"]
<div class="gallery-content">
<?php
if( has_shortcode( $post->post_content, 'gallery' ) ) :
if ( $images = get_children(array('post_parent' => get_the_ID(),'post_type' => 'attachment','post_mime_type' => 'image', 'orderby' => 'menu_order_ID'))) :
$image_list = '<ul class="galleryslider">';
foreach( $images as $image ) :
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image($image->ID, 'full' );
$img_title = $image->post_title;
$img_desc = $image->post_excerpt;
$image_list .= '<li><a href="'.$attachmenturl.'" '. $lightbox .' data-title="'.$img_desc.'" title="'.$img_title.'"><div class="gallery-image-title">'.$img_title.'</div>'.$attachmentimage.'</a><div class="gallery-image-desc">'.$img_desc.'</div></li>';
endforeach;
$image_list .= '</ul>';
echo $image_list;
endif;
endif;
?>
</div><!-- .gallery-content -->
post_gallery
in the functiongallery_shortcode()
you should use.$post
ans what do you want to show?