
wordpress如何根据tag标签名获取文章列表,下面web建站小编给大家详细介绍一下具体实现代码!
wordpress调用标签:
<?php
$tag = ''; //tag标签名
$args=array(
'tag' => $tag',
'showposts'=>5, //文章数量
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo '标签文章输出:';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">
<?php the_title(); ?></a></p>
<?php
endwhile;
}
wp_reset_query();
?>
WordPress版本如何使用str_starts_with和str_ends_with函数
wordpress教程如何输出用于回复评论的隐藏输入html
标签: wordpress函数, wordpress标签, wordpress获取文章
上面是“wordpress根据tag标签名获取文章列表”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_3749.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

YY Live
软著申请doc源代码要求
一款基于人工智能快速生成精美的产品图片工具——Pebblely
网站优化之如何快速提高网站的排名呢?