为自己的文章添加SEO权重,使用TAG标签调用WP相关文章

为自己的文章添加SEO权重,使用TAG标签调用WP相关文章

做博客写文章,做好内链,做好SEO会使得网站的权重提升!

突然想到SEO的一个想法,估计是SEO高手经常使用的!

在文章页面,文章的下方通过TAG标签来调用WP相关文章,可以提升这个TAG的一个权重,有此一点,如果我们再深入一点,

把标题也包含这个标签的话,那么推荐性就非常高的!

 

例如:TAG标签为:阿里巴巴国际站,那么标题也包含有阿里巴巴国际站,这样看起来就比较好了~

那么,有这个想法了之后,需要在编辑文章的时候执行,另外也需要修改一下模板的代码!

修改当前模板下的 文章页面 (single.php),添加一下代码:

<ul>
    <?php
    $post_num = 8; 
    global $post;
    $tmp_post = $post;
    $tags = ''; $i = 0;
    if ( get_the_tags( $post->ID ) ) {
    foreach ( get_the_tags( $post->ID ) as $tag ) $tags .= $tag->name . ',';
    $tags = strtr(rtrim($tags, ','), ' ', '-');
    $myposts =get_posts('numberposts='.$post_num.'&tag='.$tags.'&exclude='.$post->ID);
    foreach($myposts as $post) {
    setup_postdata($post);
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php
    }
    }
    $post = $tmp_post; setup_postdata($post);
    ?>
</ul>

其中:数字8是相关文章数量

灵感来自:http://faq.wopus.org/question/19354/

文章来源于网络或者作者投稿,若有侵权请联系删除,作者:老钟,如若转载,请注明出处:https://www.laoz.net/620.html

(0)
上一篇 2014 年 08 月 05 日
下一篇 2014 年 08 月 30 日

相关推荐

评论列表(10条)

  • 北京seo 2015 年 04 月 25 日 下午 10:46

    第一次来你博客哦,文章不错哦,欢迎回访www.aiyw.net

  • http://www.kaiyunpixiu.com 2014 年 11 月 13 日 下午 10:43

    我又来看你啦。

  • 贴吧头像 2014 年 08 月 25 日 下午 6:06

    是么?效果这么好哈?

  • 屠龙 2014 年 08 月 18 日 上午 9:48

    学习了。

  • 鸿念网 2014 年 08 月 17 日 下午 11:44

    我会常来光顾的,再次感谢。

  • 鞋机 2014 年 08 月 16 日 下午 4:19

    迷迷糊糊的

  • www.3464.com 2014 年 08 月 16 日 下午 1:08

    此身泰山重,勿作鸿毛遗。 (宋)苏轼

  • 纺织机厂 2014 年 08 月 15 日 上午 11:31

    看看哈

  • 一昕精选 2014 年 08 月 13 日 下午 2:07

    好深奥啊

  • 鞋机 2014 年 08 月 08 日 上午 9:39

    不懂