获取文章作者最后更新的时间,不是文章的最后更新时间,原理也比较简单,先获取作者最新更新的文章,然后再获取时间就可以了,代码也比较简单,贴一下。
[cc lang="php"]
php
$args = array( 'posts_per_page' => 1, 'author'=> get_the_author_meta('ID'), 'orderby' => 'modified' );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) : setup_postdata( $post );
最后更新:php the_date('Y/m/d');
php endforeach;wp_reset_postdata();
[/cc]
放在文章loop中就可以了。
发表评论