wordpress如何改造成熊掌号标准可以提交到熊掌号

一:添加熊掌号id在页头body前添加
<script ?src="//msite.baidu.com/sdk/c.js?appid=此处填写熊掌号id"></script>
二:添加json_ld数据<!–start–>
<!–熊掌号–>
<script src="//msite.baidu.com/sdk/c.js?appid=1595281659287879"></script>
<script type="application/ld+json">
{
"@context": "https://ziyuan.baidu.com/contexts/cambrian.jsonld",
"@id": "< ?php the_permalink(); ?>",
"appid": "熊掌号id",
"title": "< ?php the_title(); ?>",
"images": ["< ?php echo fanly_post_imgs();?>"],
"description": "< ?php echo fanly_excerpt()?>",
"pubdate": "< ?php echo get_the_time('y-m-d\th:i:s')?>"
}
</script>
<!–end–>
三:functions.php文件修改//start
//获取文章/页面摘要
function fanly_excerpt($len=220){
if ( is_single() || is_page() ){
global $post;
if ($post->post_excerpt) {
$excerpt = $post->post_excerpt;
} else {
if(preg_match('/
(.*)<\/p>/iu',trim(strip_tags($post->post_content,"
")),$result)){
$post_content = $result['1'];
} else {
$post_content_r = explode("\n",trim(strip_tags($post->post_content)));
$post_content = $post_content_r['0'];
}
$excerpt = preg_replace('#^(?:[\x00-\x7f]|[\xc0-\xff][\x80-\xbf]+){0,0}'.'((?:[\x00-\x7f]|[\xc0-\xff][\x80-\xbf]+){0,'.$len.'}).*#s','$1',$post_content);
}
return str_replace(array("\r\n", "\r", "\n"), "", $excerpt);
}
}
//获取缩略图
function fanly_post_imgs(){
global $post;
$src = '';
$content = $post->post_content;
preg_match_all('/<img src="[\"|\'](.+?)[\"|\'].*?" />/', $content, $strresult, preg_pattern_order);
$n = count($strresult[1]);
if($n >= 3){
$src = $strresult[1][0].'","'.$strresult[1][1].'","'.$strresult[1][2];
}elseif($n >= 1){
$src = $strresult[1][0];
}
return $src;
}
//end
四:页面添加进入熊掌号入口<script>cambrian.render('tail')</script>