Last active
December 14, 2015 10:49
-
-
Save tkc49/5074833 to your computer and use it in GitHub Desktop.
[WordPress] single.php List of other articles of the author who wrote the article
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>一覧</h2> | |
<ul> | |
<?php $author_id = get_the_author_meta( 'ID' ); ?> | |
<?php $posts = get_posts("author=$author_id&orderby=date&post_type=post&posts_per_page=5"); ?> | |
<?php foreach( $posts as $post ) : setup_postdata($post); ?> | |
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li> | |
<?php endforeach; ?> | |
<?php wp_reset_postdata(); ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment