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

来自:互联网
时间:2020-03-25
阅读:

wordpress调文章的标题、分类、标签、作者、时间直接用html代码做示例,大家可以按需把代码替换到自己的模板中:

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php wp_title(); ?></title>
</head>
<body> 
<!--循环调文章标题-->
 <?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;?>
</body>
</html>
返回顶部
顶部