WordPress建站教程:显示文章是否已经被百度收录

前端之家收集整理的这篇文章主要介绍了WordPress建站教程:显示文章是否已经被百度收录前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

完成以后,我们最关心的是网站是否被搜索引擎收录,网站关键词排名是否靠前以及网站的文章被收录了多少。

今天我们介绍一种方法,可以在文章中显示此文章是否被百度收录。如果该篇文章已经被百度搜索收录,则显示”百度已收录”;如果该篇文章没有被百度收录,则显示”百度未收录”,点击链接会进入百度 url 提交页面,帮助该篇文章尽快被百度收录。

1. 切换到主题目录,打开 functions.php 文件,加入以下代码:

'@H_403_1@Crayon-sy">;@H_403_1@
Crayon-line Crayon-striped-line" id="Crayon-5c891d282ef99599683481-34">Crayon-h">@H_403_1@Crayon-sy">}@H_403_1@Crayon-h"> @H_403_1@Crayon-st">else@H_403_1@Crayon-h"> @H_403_1@Crayon-sy">{@H_403_1@
Crayon-line" id="Crayon-5c891d282ef99599683481-35">Crayon-h">@H_403_1@Crayon-k ">echo@H_403_1@Crayon-h"> @H_403_1@Crayon-s">''@H_403_1@Crayon-sy">;@H_403_1@
Crayon-line Crayon-striped-line" id="Crayon-5c891d282ef99599683481-36">Crayon-h">@H_403_1@Crayon-sy">}@H_403_1@Crayon-h"> @H_403_1@
Crayon-line" id="Crayon-5c891d282ef99599683481-37">Crayon-sy">}@H_403_1@
Crayon-line Crayon-striped-line" id="Crayon-5c891d282ef99599683481-38">@H_403_1@

2. 在文章页面 single.PHP 合适的位置上添加如下代码

Crayon-5c891d282efa8299812164" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">@H_403_1@
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-mixed-highlight" title="Contains Mixed Languages">@H_403_1@
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-button-icon">
Crayon-language">PHP@H_403_1@
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891d282efa8299812164-1">1
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d282efa8299812164-1">Crayon-ta">PHP@H_403_1@Crayon-h"> @H_403_1@Crayon-e">baidu_record@H_403_1@Crayon-sy">(@H_403_1@Crayon-sy">)@H_403_1@Crayon-sy">;@H_403_1@Crayon-h"> @H_403_1@@H_403_1@

猜你在找的wordpress相关文章