全球主机交流论坛
标题:
wp如何通过【英文】TAG关键词调用相关文章?关键词是英文TAG
[打印本页]
作者:
leftgg
时间:
2019-11-24 11:44
标题:
wp如何通过【英文】TAG关键词调用相关文章?关键词是英文TAG
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>
复制代码
作者:
leftgg
时间:
2019-11-24 14:47
作者:
leftgg
时间:
2019-11-24 19:29
作者:
leftgg
时间:
2019-11-24 21:09
技术类的没人回复吗??
作者:
怪人
时间:
2019-11-24 23:06
提示:
作者被禁止或删除 内容自动屏蔽
作者:
天有点热
时间:
2019-11-25 08:27
大部分主题都有tag.php这个页面,参考下别人怎么调用的
欢迎光临 全球主机交流论坛 (https://loc.mjj8.eu.org/)
Powered by Discuz! X3.4