WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Display all posts in author.php (4 posts)

  1. silfver
    Member
    Posted 6 years ago #

    Hey!

    In my settings, under read, i've set the number of posts to be displayed to 2.

    So when i'm looping out the posts that a user have been writing in author.php with this code:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    It of course only shows two posts.

    I want to loop all posts out. Is this possible? Without changing the settings on my frontpage of course.

    Hope you guys understand what I mean! Cheers.

  2. Kafkaesqui

    Posted 6 years ago #

    Manual option:

    <?php query_posts($query_string . '&posts_per_page=-1'); ?>
    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    Reference:
    http://codex.wordpress.org/Template_Tags/query_posts

    Plugin option:

    http://www.transycan.net/blogtest/2007/10/30/custom-query-string-reloaded-for-wordpress-23-with-tag-support/

  3. silfver
    Member
    Posted 6 years ago #

    query_posts('author_name=' .$curauth->user_login .'&posts_per_page=-1');

    Solved. Thanks!

  4. alexleonard
    Member
    Posted 6 years ago #

    And don't forget that $query_string at the start of the query_posts function - it's very important!

Topic Closed

This topic has been closed to new replies.

About this Topic