I added a template php to my Wordpress site, showing a basketball image from url, I'd like this to be the thumbnail of my website when sharing on social media

My php template-


*Template Name: demo
*Template Post Type: post, page


$image = 'https://ff.com/basketball.jpg';
$imageData = base64_encode(file_get_contents($image));
echo '<img src="data:image/jpeg;base64,'.$imageData.'" alt=“image description” title=“image tooltip”>';

When I load my website , I see a basketball image thanks to this template. But when I share my website I have no thumbnail

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.