简体   繁体   English

我如何在核心 php 中而不是在 wordpress 中创建特色图像功能

[英]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 ? wordpress 中的每个页面都有一个功能,所以如果我们在其他网站上共享链接,那么它会获取该页面/帖子的标题、描述和特色图像,但我想在核心 php 中而不是在 wordpress 中实现此功能,我该如何实现所以当我分享到其他网站的链接时,它只会获取一张特色图片? 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.如果我理解正确,您需要做的就是在 PHP/HTML 标头上添加 OpenGraph。

    <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.在 HTML/PHP 文件的 HEAD 部分插入上述代码(并根据需要调整值)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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