1

I have a listing site and various authors create custom posts (job_listing) On the listing post itself, I would like to show the links to the last 5 NORMAL blog posts by that author

Is this anywhere near right?

<?php
$args = array(
    'post_type' => 'job_listing',
    'author' => get_the_author_meta( 'ID' )
);
$listing_post = new WP_Query( $args );
if( $listing_post->have_posts() ){
    while( $listing_post->have_posts() ){
        $listing_post->the_post();
        the_permalink();
    }
}
// reset $post global to original value
wp_reset_postdata();
?>

Then after this query, how do I then output the result in a list of anchor links?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.