WordPress.org

Forums

[resolved] Remove post per page limit and sort alphabetically (4 posts)

  1. gattopranzo
    Member
    Posted 4 years ago #

    Hello

    Can somebody help me with the following problem:

    In the archive area of my blog I want to show on top all relevant post titles (and hence remove the post per limit temporarily) and list them in alphabetical order.

    I manage to one of the two but not both:

    If I use:

    <?php $posts = query_posts( $query_string . '&orderby=title&order=asc' ) ?>

    The post titles are ordered but the post per page limit is enforced

    If I use:

    <?php $posts = query_posts( 'posts_per_page=-1&cat=' . $cat ) ?>

    The post titles are not order but the limit is removed (and somehow strangely the monthly archives now include all post titles even from other months but the category archives work fine)

    Is there a way to combine the two codes: Ie.: order the applicable archive posts alphabetically and the remove the post per page limit temporarily in order to display all relevant blog titles?

    Thanks!

  2. vtxyzzy
    Member
    Posted 4 years ago #

    Give this a try:

    <?php $posts = query_posts( $query_string . '&orderby=title&order=asc&posts_per_page=-1' ) ?>

  3. gattopranzo
    Member
    Posted 4 years ago #

    Works like a dream, thanks!

  4. vtxyzzy
    Member
    Posted 4 years ago #

    You are welcome!

Topic Closed

This topic has been closed to new replies.

About this Topic