简体   繁体   中英

How can i create Featured Image function in core php not in wordpress

There is a function for every page in wordpress so if we share link in other websites then it fetches title, description and featured image of that page / post, but i wanna make this functionality in core php not in wordpress, how can i make it so when i share link to other website then it fetches only that one featured image ? without featured image functionality it fetches only logo.

please could you help me?

If I understand correctly, all you need to do is add OpenGraph on your PHP/HTML header.

    <meta property="og:title" content="Your desired title" />
    <meta property="og:description" content="Some sentences here" />
    <meta property="og:url" content="https://www.yourdomain.com/filename.php" />
    <meta property="og:site_name" content="rumahweb.com" />
    <meta property="og:image" content="https://www.yourdomain.com/featured-image.png" />

Insert above code (and adjust the value as necessary) inside your HEAD section of your HTML/PHP file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM