WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Query post type in category page (4 posts)

  1. jumust
    Member
    Posted 2 years ago #

    Hi,
    I have a custom post type category page : custom_category.php

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    MY CONTENT
    	<?php endwhile; endif; ?>

    It gets all posts correctly in each current subcategory, in chronologically order but I want them to be alphabetically sorted and still get posts from current category.

    Hope you can help me.

  2. marv51
    Member
    Posted 2 years ago #

    You can alter the query with query_posts() (Codex)

    The example about "Preserving Existing Query Parameters" does almost exactly what you want (I guess):

    global $query_string;
    query_posts( $query_string . '&order=ASC' );

    (This should go before the loop)

  3. jumust
    Member
    Posted 2 years ago #

    Great it did the job!

  4. marv51
    Member
    Posted 2 years ago #

    Glad I could help.
    Please mark this thread as resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic