List only logged in author’s posts – WordPress tricks

To list logged in author’s post and put an edit link after the title you can use following function:

function logged_in_author_posts(){
if( !is_user_logged_in())
	return false;
$user_id = get_current_user_id();
query_posts( array( 'post_type' => 'post', 'author' => $user_id, 'post_status' => 'publish', 'showposts' => '-1' ));
if( have_posts()):
	echo '<h2>Your posts</h2>';
	echo '<ul>';
	while (have_posts()) : the_post();
		echo '<li>';
		the_title();
		edit_post_link( __('Edit'), ' <span>', '</span>' );
		// the_excerpt();
		echo '</li>';
	endwhile;
endif;
}

You can take out the double-slash ‘//’ quotation from // the_excerpt(); to show post excerpt.
Now you can use logged_in_author_posts() anywhere in you theme to display the list. List will only appear if user is logged in and have atleast one post published.

logged_in_author_posts();