Created
January 18, 2015 19:24
-
-
Save shahadat014/06d2f3943bd3f1cea623 to your computer and use it in GitHub Desktop.
Show author more post
This file contains hidden or 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
| Use in theme functions.php file | |
| function get_related_author_posts() { | |
| global $authordata, $post; | |
| $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ), 'posts_per_page' => 5 ) ); | |
| $output = '<ul>'; | |
| foreach ( $authors_posts as $authors_post ) { | |
| $output .= '<li><a href="' . get_permalink( $authors_post->ID ) . '">' . apply_filters( 'the_title', $authors_post->post_title, $authors_post->ID ) . '</a></li>'; | |
| } | |
| $output .= '</ul>'; | |
| return $output; | |
| } | |
| To use in position | |
| < ?php echo get_related_author_posts(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment