I'm developing a gallery plugin that shows featured image as album cover. But I need to show some text info in this album cover. So I got the image title to be the name, its working ok. But for the description I need to have 2 lines (one for the info and one for the phone), So I thought that I could use the caption with a line break [return] or even using the br tag, but both does not work (came empty). It only works with a single line text. See my code below, I must be doing something wrong. Any help will be appreciated.
if( $query->have_posts() ) {
$response = '<div id="galery">';
while( $query->have_posts() ) {
$query->the_post();
if( has_post_thumbnail( get_the_ID() ) ) {
$response .= '<div class="image">';
$response .= '<a href="' . get_permalink( get_the_ID() ) . '" title="' . esc_attr( get_the_title( get_the_ID() ) ) . '">';
$photo = get_the_post_thumbnail( get_the_ID() );
preg_match('/alt="(.*)"/',$photo,$matches);
$response .= $photo.'</a>';
$response .= '<div class="tarja"><span class="name">'.esc_attr( get_the_title( get_the_ID() ) ).'</span><br/>';
$response .= '<span class="info-phone">'.$matches[1].'</span></div></div>';
}
}
$response .= '</div>';
}
wp_reset_query();
return $response;
}