Skip to content

Instantly share code, notes, and snippets.

@eftalyurtseven
Created October 12, 2012 14:32
Show Gist options
  • Save eftalyurtseven/3879486 to your computer and use it in GitHub Desktop.
Save eftalyurtseven/3879486 to your computer and use it in GitHub Desktop.
Wordpress Yazara ait Benzer Yazıları Listelemek
function yazarin_benzer_yazilari() {
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment