導讀:網(wǎng)站搭建網(wǎng)站搭建最近想搞個熊掌號來玩玩,于是在前兩天申請并且通過.申請通過后需要對網(wǎng)站進行改造,于是翻閱互連網(wǎng),東拼西湊終于搞定,完成改造,下面分享下頁面改造過程.改造之前需注自助建站技術(shù)技術(shù)支持網(wǎng)站。

最近想搞個熊掌號來玩玩,于是在前兩天申請并且通過.申請通過后需要對網(wǎng)站進行改造,于是翻閱互連網(wǎng),東拼西湊終于搞定,完成改造,下面分享下頁面改造過程.改造之前需注冊熊掌號,點此打開,申請次數(shù)有限,申請時注意手持身份證照片最好是原圖,避免系統(tǒng)識別不到身份證信息.不同WordPress主題改造文件有所不同,這里我當前使用知更鳥Lts版本,需用到的3個文件分別為functions.php、head.php、content.php
首先使用到的是head.php,添加熊掌號ID聲明,代碼如下:
<script?src="http://msite.baidu.com/sdk/c.js?appid=此處填寫熊掌號ID"></script>
添加JSON_LD數(shù)據(jù)
<!--Start-->
<!--熊掌號-->
<script?src="http://msite.baidu.com/sdk/c.js?appid=1595281659287879"></script>
<script?type="application/ld+json">
????????{
????????????"@context":?"https://ziyuan.baidu.com/contexts/cambria手機模板deden.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>(.*)<\/p>/iU',trim(strip_tags($post->post_content,"<p>")),$result)){
????????????????$post_content?=?$result['1'];
????????????}?else?{
????????????????$post_content_r?=?explode("\n",trim(strip_tags($post->post_content)));
關(guān)鍵詞標簽: 網(wǎng)站搭建 頁面 熊掌
聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-07-23 ,文章三分鐘學會WordPress接入熊掌號及頁面改造,網(wǎng)站搭主要講述熊掌,頁面,網(wǎng)站搭建網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請保留鏈接: http://www.bifwcx.com/article/web_35681.html