Title: Order Category Posts
Last modified: September 1, 2016

---

# Order Category Posts

 *  [bluedrag](https://wordpress.org/support/users/bluedrag/)
 * (@bluedrag)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/order-category-posts/)
 * I’d like to order all the posts listed on my category.php page alphabetically.
 * Here is the code on my category.php page:
 *     ```
       <?php
       /**
        * The template for displaying Category Archive pages.
        */
   
       get_header(); ?>
       <?php global $q_config; ?>
   
       			<div id="product_gallery" role="main">
   
       			<?php while ( have_posts() ) : the_post(); ?>
   
        			 <?php 	//This checks what language qTranslate has selected and returns the appropriate ShortDesc
       					if (ppqtrans_getLanguage() =="en") {
       					   $key = "byline_en";
       					   $description = get_post_meta($post->ID, $key, true);
       					}
       					if (ppqtrans_getLanguage() =="fr") {
       					   $key = "byline_fr";
       					   $description = get_post_meta($post->ID, $key, true);
       					}
       				?>
   
       			<div class="product_thumbnail">
       			<a href="<?php the_permalink() ?>">
       			<?php //the_post_thumbnail grabs the post's "featured image" this feature has added theme support in the child theme functions.php ?>
       			<?php the_post_thumbnail('thumbnail', array('class' => 'thumbnail')); ?>
       			</a>
   
       			<?php //This piece of code figures out the corrosponding post_title of the featured image ?>
       			<h1 class="post_caption"><?php the_title(); ?></h1>
       			<p><?php echo $description; ?></p>
       			</div> <!-- product_thumbnail -->
   
       			<?php endwhile; // end of the loop. ?>
   
       			<div class="clear"></div>
   
       </div><!-- #content -->
   
       <?php get_footer(); ?>
       ```
   
 * What do you think the best way to go about that would be?

Viewing 1 replies (of 1 total)

 *  [bdbrown](https://wordpress.org/support/users/bdbrown/)
 * (@bdbrown)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/order-category-posts/#post-7691117)
 * Hi bluedrag. Take a look at the pre_get_posts() action:
    [https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts](https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts)
 * Some examples:
    [http://devotepress.com/tutorials-hacks/wordpress-coding/when-to-use-pre_get_posts-in-wordpress/](http://devotepress.com/tutorials-hacks/wordpress-coding/when-to-use-pre_get_posts-in-wordpress/)

Viewing 1 replies (of 1 total)

The topic ‘Order Category Posts’ is closed to new replies.

## Tags

 * [alphabetically](https://wordpress.org/support/topic-tag/alphabetically/)
 * [category](https://wordpress.org/support/topic-tag/category/)
 * [list](https://wordpress.org/support/topic-tag/list/)
 * [order](https://wordpress.org/support/topic-tag/order/)
 * [orderby](https://wordpress.org/support/topic-tag/orderby/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [bdbrown](https://wordpress.org/support/users/bdbrown/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/order-category-posts/#post-7691117)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
