Echo page thumbnail URL

Permalink 1 user found helpful
I'm in process of adding some dynamic schema markup to my website.

So far, I've managed to dynamically include everything for the particular schema type.

I'm struggling to echo the URL of the page thumb.

Could anyone please advise how to do this please?

 
washingbasket replied on at Permalink Reply
Edit - I have managed to get this working, but am curious whether there is a more elegant way?

//Define variable for Thumbnail Image
$img = $c->getAttribute('thumbnail');
<?php if ($img !== null) {
                echo ($c->getAttribute('thumbnail')->getVersion()->getURL());
           } else {
           echo 'backup-image-url.jpg';
      }
?>
shahroq replied on at Permalink Reply
shahroq
You can find the required code on this cheatsheet:
https://github.com/shahroq/whale_c5_cheat_sheet#get-a-page-attribute...
hammers replied on at Permalink Reply
Thank you for the link. Actually, I've been searching for this http://aolsigninhelp.com solution on the whole forum.
Thanks again.