[resolved] Custom post type Archive duplicates posts if Sorted (by title for example) (3 posts)

  1. Wiki Chaves
    Posted 4 years ago #


    I've created a new custom post type archive page for my "People" (archive-people.php) and worked fine, till I've decided to sort the list in a particular way.

    I've included
    $posts = query_posts($query_string . '&orderby=title&order=asc'); ?>

    before if (have_posts()) : ....

    Doing this i can see the first entries of each page duplicated

    Am I doing something wrong or there is a bug with the CPT archive page ?


  2. Rev. Voodoo
    Volunteer Moderator
    Posted 4 years ago #

    I just set up my archives, and they went well except one issue.

    Seems if I do any sort of query, then I need to specify the CPT in the query

    for instance I had this in my archive-ve_members.php:

    query_posts( array(
          'posts_per_page' => 30,
          'order' => 'ASC',
          'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),

    Because I wanted 30 members to show at a time, and I wanted the posts to display backwards, from first added to most recent

    Before I put that query in, everything worked perfectly. As soon as I added that query, I had all sorts of other posts and duplicate content show up. But when I put

    'post_type' => 've_members',

    in there, all was right with the world again..... Seems a bit odd to me. Seems dropping in any sort of query messes up the expected output.....

  3. Wiki Chaves
    Posted 4 years ago #

    Great ! seems that i had somethig bad in my query

    Thanks !

Topic Closed

This topic has been closed to new replies.

About this Topic