I would like to create a page template that will display all of the posts by the currently logged in user. I managed to find an older thread which contained this code:
if ( is_user_logged_in() ):
global $current_user;
get_currentuserinfo();
$author_query = array('posts_per_page' => '-1','author' => $current_user->ID);
$author_posts = new WP_Query($author_query);
while($author_posts->have_posts()) : $author_posts->the_post();
?>
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
<?php
endwhile;
else :
echo "not logged in";
endif;
however, the code does not appear to work (in fact, any page using the template which contains it simply won't load).
<?php
tag before it. if you've made an error, enabling debugging will tell you what it is and on what line. – Milo Nov 10 '13 at 16:27