Javier Velez
asked 8 years ago

I’d like to display a caption for each image on the slideshow in those posts marked as “Gallery”
Please let me know.
 
Thanks

1 Answers
DominicStaff
answered 8 years ago

Hello Javier !
To display captions for images in a Gallery post type, You can open the function.php file in the folder path “\wp-content\themes\dw-focus”
find the line 231 then add the following code Under the line code “$output .= “<img src='”.$full_url[0].”‘ />”;

$output .= "<span class='wp_caption'>". get_post($img_id)->post_excerpt ."</span>";

Then log in to Dashboard > Appearance > Customize > General code, add the following code to the “Header Script”

 <style>
.gallery .wp_caption {
position: absolute;
bottom: 0;
width: 100%;
text-align: center;
color: #fff;
padding: 10px 0;
background: rgba(255,255,255,.3);
}
</style>

Hope this helps !  

Powered by DW Question & Answer Pro