Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Sprinto on "Show posts from auther"

$
0
0

Hey guys,

Im having a problem with getting recent posts from a specific auther.

I found a function that let be do it.

function my_get_display_author_posts() {
    global $authordata, $post;

    $authors_posts = get_posts( array( 'author' => $authordata->ID, 'post__not_in' => array( $post->ID ) ) );

    $output = '<ul>';

    $i = 0;
    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>';
        if(++$i > 4) break;
    }
    $output .= '</ul>';

    return $output;
};

But it only takes post 2,3,4,5 and not the most recent post.. Can anyone help me out? You can take a look at a post here: http://trendthis.dk/ny-bikini-trend-wtf/


Viewing all articles
Browse latest Browse all 8245

Trending Articles