wp如何通过【英文】TAG关键词调用相关文章?
关键词是英文TAG
- <ul>
- <?php
- $post_num = 10;
- 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>
复制代码
陕西网友:技术类的没人回复吗??
香港网友:主要不懂
西藏网友:大部分主题都有tag.php这个页面,参考下别人怎么调用的