I have this code in the folowing post type, but the lightbox is not created. What am I missing?
function display_documents(){
$args = array(
'post_type' => 'documents',
'post_status' => 'publish'
);
$string = '';
$query = new WP_Query( $args );
if( $query->have_posts() ){
while( $query->have_posts() ){
$query->the_post();
$image = get_field('image');
$string .= '<div class="x-column x-sm x-1-5">';
$string .= '<img src="' . $image .'"/>';
$string .= '<a href="#">' . get_the_title() . '</a>';
$string .= do_shortcode( '[image src="'. $image .'" link="true" class="lb"]' );
$string .= '</div>';
}
}
do_shortcode('[lightbox selector=".lb"]');
wp_reset_query();
return $string;
}