List posts using $curauth
-
Hi,
I want to display five post titles of a specific author using $curauth;
I had a snippet of code that used to work just fine, but with some WordPress update it stopped working and I’m not sure why or how to fix it.
My old, formerly flawlessly working code looks like this:<ul><?php query_posts('&author='.$curauth->ID.'showposts=5'); if (have_posts()) : while (have_posts()) : the_post(); ?> <li><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a> am <?php the_time('d.m.Y'); ?></li> <?php endwhile;?> </ul> <a href="<?php echo get_author_posts_url($authid); ?>?allposts=true">all posts by <?php echo $curauth->first_name; ?> →</a> <?php else: ?> <li><?php _e('No posts found.'); ?></li> </ul> <?php endif; ?>
Now, it always returns “No posts found”.
When checking the documentation of $query_posts I learned that it’s not recommended to use it anymore, but I don’t know what the alternative is and how to make this work again.Any ideas? Thanks a lot! ??
- The topic ‘List posts using $curauth’ is closed to new replies.