I have custom PHP scope in my WordPress theme, like this:
foreach ($myprojects as $post){
setup_postdata( $post );
$output .= '<div class="col-xs-6 col-sm-3">';
$output .= '<div class="portfolio-item">';
if (has_post_thumbnail($post->ID)) {
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'medium');
$large_image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
$content = get_post_field('post_content', $post_id);
$output .= '<img class="img-responsive" src="'.$thumb[0].'" title="" alt="">';
}else{
$output .= '<img class="img-responsive" src="images/work_1.jpg" title="" alt="">';
}
$post_id = get_the_title($post->ID);
$post_name = CFS()->get('project_name', '');
$output .= '<a class="overlay" rel="shadowbox" href="'.$large_image[0].'">';
$output .= '<p class="btn-preview">'.$post_id.'</p>';
$output .= '</a>';
$output .= '</div>';
$output .= '</div>';
$count++;
$index++;
}
Yes, it works fine. When I click a
tag, open $large_image
via prettyPhoto.
But this code for single image. I want to thumbnails stay same, but when click to link, open that multiple image via prettyPhoto. So, imported 2 images in post body and want to show these images.
In a nutshell, this code:
$large_image = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full');
Must be like this:
$large_image = wp_get_attachment_image_src( $body($post->ID), 'full');
But I know, this is not correct code. Its pseudo.
How can I fix my problem? Thanks.
Change your lightbox solution to fancyBox, use
data-fancybox-group
and a bit of WordPress/PHP knowledge… that’s it!