wp如何通过【英文】TAG关键词调用相关文章?关键词是英文TAG

搬瓦工机场JMS

wp如何通过【英文】TAG关键词调用相关文章?

关键词是英文TAG

  1. <ul>
  2. <?php
  3. $post_num = 10;
  4. global $post;
  5. $tmp_post = $post;
  6. $tags = ”; $i = 0;
  7. if ( get_the_tags( $post->ID ) ) {
  8. foreach ( get_the_tags( $post->ID ) as $tag ) $tags .= $tag->name . ‘,’;
  9. $tags = strtr(rtrim($tags, ‘,’), ‘ ‘, ‘-‘);
  10. $myposts =get_posts(‘numberposts=’.$post_num.’&tag=’.$tags.’&exclude=’.$post->ID);
  11. foreach($myposts as $post) {
  12. setup_postdata($post);
  13. ?>
  14. <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
  15. <?php
  16. }
  17. }
  18. $post = $tmp_post; setup_postdata($post);
  19. ?>
  20. </ul>

复制代码

陕西网友:技术类的没人回复吗??
香港网友:主要不懂
西藏网友:大部分主题都有tag.php这个页面,参考下别人怎么调用的

未经允许不得转载:美国VPS_搬瓦工CN2 GIA VPS » wp如何通过【英文】TAG关键词调用相关文章?关键词是英文TAG

赞 (0) 打赏

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏