中文字幕在线观看,亚洲а∨天堂久久精品9966,亚洲成a人片在线观看你懂的,亚洲av成人片无码网站,亚洲国产精品无码久久久五月天

純代碼替換All-in-One-SEO插件,實(shí)現(xiàn)WordPress SEO優(yōu)化

2018-11-01    來源:學(xué)做網(wǎng)站論壇

容器云強(qiáng)勢(shì)上線!快速搭建集群,上萬Linux鏡像隨意使用

熟悉Wordpress的朋友對(duì)SEO插件All in One SEO應(yīng)該很熟悉,這是一個(gè)對(duì)SEO很有幫助的插件。但是這個(gè)插件如果處理noindex時(shí)不得當(dāng),會(huì)造成百度不收錄的影響。而且一旦使用了這個(gè)插件一段時(shí)間后,一旦停止使用,會(huì)造成搜索引擎抓取的Meta大幅丟失,影響搜索排名。

seocj

那么有什么好的方法,既可以完美自定義關(guān)鍵字(keywords)和頁面描述(description)呢?經(jīng)過多方面的測(cè)試,完美的解決方法出爐,在這里分享給所有學(xué)習(xí)wordpress使用教程的學(xué)員!

第一步:打開主題的header.php文件,找到title標(biāo)簽,把下面的代碼替換到你的主題中。當(dāng)然,你也可以根據(jù)自己的要求作適當(dāng)調(diào)整下面的代碼。

<title><?php
/*
?    * Print the <title> tag based on what is being viewed.
?    */
global $page, $paged;     wp_title( '-', true, 'right' );
// Add the blog name.
bloginfo( 'name' );
// Add the blog description for the home/front page.
$site_description = get_bloginfo( 'description', 'display' );
if ( $site_description && ( is_home() || is_front_page() ) )
echo " – $site_description";
// Add a page number if necessary:
if ( $paged >= 2 || $page >= 2 )
echo ' – ' . sprintf( __( 'Page %s', 'twentyten' ), max( $paged, $page ) );
?></title>
<?php
if (is_home()){
$description = "學(xué)做網(wǎng)站論壇https://www.xuewangzhan.com/描述";
$keywords = "學(xué)做網(wǎng)站論壇https://www.xuewangzhan.com/關(guān)鍵詞";

}
elseif (is_single()) {
if ($post->post_excerpt) {
$description     = $post->post_excerpt;
} else {
$description = substr(strip_tags($post->post_content),0,220);
}
$description2 = mb_strimwidth(strip_tags(apply_filters('the_content', $post->post_content)), 0, 200, "…");
$keywords = get_post_meta($post->ID, "keywords", true);
if($keywords == '') {
$tags = wp_get_post_tags($post->ID);
foreach ($tags as $tag ) {
$keywords = $keywords . $tag->name . ", ";
}
$keywords = rtrim($keywords, ', ');
}
}
elseif (is_category()) {
$description = category_description();
$keywords = single_cat_title('', false);
}
elseif (is_tag()){
$description = tag_description();
$keywords = single_tag_title('', false);
}
$description = trim(strip_tags($description));
$keywords = trim(strip_tags($keywords));
?>
<meta name="description" content=”<?php echo $description; ?>" />
<meta name="keywords" content=”<?php echo $keywords; ?>" />

第二步:進(jìn)入你的wordpress后臺(tái),在編輯文章頁面中,點(diǎn)擊右上角[顯示選項(xiàng)],選 擇[摘要]。在[摘要]中輸入這篇文章的頁面描述(description)。標(biāo)簽則為關(guān)鍵字(keywords)。如果沒有填寫文章摘要,也可以自動(dòng)抓 取文章前200個(gè)字作為Description。

這樣一來就大功告成了,以后就不要使用wordpress插件就可以實(shí)現(xiàn)網(wǎng)站seo優(yōu)化了。(相關(guān)知識(shí):怎么做網(wǎng)站seo優(yōu)化?)

標(biāo)簽: isp seo 代碼 排名 搜索 搜索引擎

版權(quán)申明:本站文章部分自網(wǎng)絡(luò),如有侵權(quán),請(qǐng)聯(lián)系:west999com@outlook.com
特別注意:本站所有轉(zhuǎn)載文章言論不代表本站觀點(diǎn)!
本站所提供的圖片等素材,版權(quán)歸原作者所有,如需使用,請(qǐng)與原作者聯(lián)系。

上一篇:如何用htaccess實(shí)現(xiàn)301重定向

下一篇:純代碼實(shí)現(xiàn)WordPress長(zhǎng)文章分頁