Forums

Latest Posts by Author
Automatically display all your own posts? (4 posts)

  1. nicholasbarry
    Member
    Posted 6 months ago #

    I see that you can manually specify a particular user. But is there a way to have the list automatically display the latest posts by whoever is logged in? I'd like each author to be able to see a list of their own latest posts.

    http://wordpress.org/extend/plugins/latest-posts-by-author/

  2. Alex Mansfield
    Member
    Posted 6 months ago #

    No, this feature is not built into the plugin. I believe you could modify the plugin using the wp_get_current_user() function and hopefully come up with something pretty close to what you're describing though.

    http://codex.wordpress.org/Function_Reference/wp_get_current_user

  3. nicholasbarry
    Member
    Posted 5 months ago #

    Ok, I found a solution. First, I'm using the Shortcode Exec PHP plugin to allow me to execute PHP on pages. Then I use this PHP:

    global $current_user;
          get_currentuserinfo();
        $my_posts = get_posts( array( 'author' => $current_user->ID, 'numberposts' => 100 ) );
    
        $output = '
    <ul>';
        foreach ( $my_posts as $my_post ) {
            $output .= '
    <li><a>ID ) . '">' . apply_filters( 'the_title', $my_post->post_title, $my_post->ID ) . '</a>, (<a>ID . '&action=edit" target="_blank">Edit</a>)</li>
    ';
        }
        $output .= '</ul>
    ';
    
        return $output;

    That loads all the posts by whoever's logged in (up to 100). If you're not logged in, it just shows all the posts (up to 100).

  4. Alex Mansfield
    Member
    Posted 5 months ago #

    I'm glad to hear you found a solution! Thanks for posting it.

Reply

You must log in to post.

About this Plugin

About this Topic