How to set the featured image / website thumbnail from my php code?
-
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-
<?php /* *Template Name: demo *Template Post Type: post, page */ get_header(); $image = 'https://ff.com/basketball.jpg'; $imageData = base64_encode(file_get_contents($image)); echo '<img src="image/jpeg;base64,'.$imageData.'" alt="“image" />'; ?>
When I load my website , I see a basketball image thanks to this template. But when I share my website I have no thumbnail
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘How to set the featured image / website thumbnail from my php code?’ is closed to new replies.