I have in category page created for a custom post type A : A_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
I tried this
<?php $args = array( 'post_type' => 'A', 'posts_per_page'=>10, 'orderby'=>'title','order'=>'ASC'); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> MY CONTENT <?php endwhile; endif; ?>
but in each subcategory it gets all custom posts from all subcategories and not from the current category. how can I do?
- The topic ‘Order post alphabetically by category’ is closed to new replies.