Related Jobs by author
I'm trying to add related jobs by this author under each job listing. I've found this code but it's only for blog posts. Does anyone know how to make this work for jobs instead?
Thanks.
Andrew
/*add to your functions file*/
/* display related posts by same author*/
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;
}
/*add this hook where you need the related posts*/
<?php echo get_related_author_posts(); ?>