WordPress调用文章的标题、分类、标签、作者、时间

评论3,877

wordpress调文章的标题、分类、标签、作者、时间代码如下

<!--循环调文章标题-->
 <?php
 if(have_posts()):while(have_posts()):the_post();?>
 
<div class='posts' style='margin:20px 0;background:green;'>
    <h2><a href='<?php the_permalink(); ?>'><?php the_title();?></a></h2
    <div class='cat'>所属的分类目录:<?php the_category('>>','multiple');?></div>
    <div class='tag'>所属标签:<?php the_tags("<span style='background:red;'>",'  、  ','</span>');?></div>
    <div class='zuozhe'>文章作者:<?php the_author();?> </div>
    <div class='zuozhe'>文章作者与存档连接:<?php the_author_posts_link();?> </div>
    <div class='time'>文章发表时间:<?php the_time('Y m d h:i:s');?></div>
</div> 
<?php endwhile;?>
 <?php endif;?>
?>

 最后更新:2022-6-20

发表评论