你好,我正在尝试添加自定义元标签从facebook共享按钮内的图像。php文件,我不知道它们为什么不显示,我的代码是这样的:
function add_facebook_image_code(){
?>
<meta property="og:url" content="http://www.example.com/<?=$post->post_name ?>/" />
<meta property="og:type" content="website" />
<meta property="og:title" content="example.com - <?=$post->post_title ?>" />
<meta property="og:image" content="<?=$post->guid ?>" />
<?php
}
add_action(\'wp_head\', \'add_facebook_image_code\');
我将此代码添加到图像中。php,是否只能在该文件中执行?谢谢并致以最良好的问候。