WordPress文章调用

首先介绍一下文章分类id的获取
打开数据库,terms数据表下term_id便是文章分类。

一:调用指定分类文章下一定数目的文章标题。
7, // 分类ID 'posts_per_page' => 5, // 显示篇数 ); query_posts($args); if(have_posts()) : while (have_posts()) : the_post(); ?>
//文章标题

二:WordPress中显示文章发布时间
php the_time('Y年n月j日'); ?> //显示年月日
php the_time('G:i:s'); ?> //显示时分秒
注:除了the_time函数外,还有the_date函数。使用the_date() 函数,只能显示第一篇文章的发表日期(即,多篇文章是同一日发布的,the_date()只会输出一次时间)。
如果想每篇文章都有显示一个发布时间就要使用the_time() .

ps(加实线跟加虚线
加虚线:border-bottom: 1px dashed #DDD;
加实线:border-bottom: 1px solid #DDD;)
今天暂且就用了这些东西。对你们有用的话,求赞。

猜你喜欢

转载自www.cnblogs.com/homehtml/p/12681256.html