thanks gents,
I should have earlier been clearer and said this ‘Caption’ is the metadata which user enters for the image when uploaded into WordPress media library, i.e. Title, Caption, Alt text, and Description. I am sure you are familiar.
after some more study it now must be the Description instead of Caption. Suitable for longer text.
Thanks for the code provided but I am having trouble seeing how to target each WordPress Page with the php code. So would a revised simple method work..
rather than using php in page template, what if I use per-Page approach instead.
So on a WordPress Page I insert an image using visual editor
then below it in editor place a shortcode to pull and place it’s Description right underneath image. (Just like the default WordPress setup of Caption is shown underneath a thumbnail image but I am going to be inserting a medium or Large image size and require the Description instead of Caption). Normally Description is on Attachment page on link off
If shortcode has no chance then I wonder if php could be used so the ID doesn’t need to be mentioned but the code somehow just automatically loads the Description for each image for each page. Put some code in functions then also in custom template. The is_page thing is very repetitive
thanks