Title: Sorting Posts Alphabetically
Last modified: August 19, 2016

---

# Sorting Posts Alphabetically

 *  [sarcasteak](https://wordpress.org/support/users/sarcasteak/)
 * (@sarcasteak)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/sorting-posts-alphabetically-2/)
 * Hi. I am attempting to sort my posts alphabetically under category, for example:
 * [http://www.bloodylexicon.com/category/monsters/](http://www.bloodylexicon.com/category/monsters/)
 * I modified this line in the category.php for the template, but it doesn’t seem
   to be working correctly. Any ideas?
 * `<?php wp_get_archives('type=monthly&format=link&orderby=title&order=asc'); ?
   >`

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [sarcasteak](https://wordpress.org/support/users/sarcasteak/)
 * (@sarcasteak)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/sorting-posts-alphabetically-2/#post-1354165)
 * Hi, so I know I modified the wrong part. I am a programmer but php is not my 
   expertise. Where/how are these methods included from? I don’t see any include
   functions in my php that contain the method “single_cat_title”, also, how does
   have_posts() know to only pull back ones of this category? The code that I am
   concerned about is here:
 *     ```
       <h3><?php single_cat_title(); ?></h3>
   
       <?php while(have_posts()) : the_post(); ?>
       <div class="excerpt">
       			<h2><a href="<?php echo get_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a> </h2>
   
       						<div class="excerptentry"><?php the_excerpt(); ?><div class="excerptlink"><a href="<?php echo get_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"> Click for more information...</a></div></div>
   
       		<div class="postmetadata">
   
       			<span class="date">Posted in <?php the_time('F jS, Y') ?></span>
   
       			<span class="comment"> <?php comments_popup_link('No Comments »','1 Comment »','% Comments »'); ?></span>
   
       			<span class="tag"><?php the_tags('Tags: ', ', ', ''); ?></span>
   
       		</div>
               <div class="clear"></div>
       </div>
       ```
   
 * <?php endwhile; ?>`
 *  Thread Starter [sarcasteak](https://wordpress.org/support/users/sarcasteak/)
 * (@sarcasteak)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/sorting-posts-alphabetically-2/#post-1354167)
 * Okay, so I found the tutorial on wordpress’s website, and I did not assume it
   was as easy as
 *     ```
       <?php
        $posts = query_posts($query_string .
       '&orderby=title&order=asc&posts_per_page=10');
       ?>
       ```
   
 * How do I have access to change the $posts variable and it magically modifies 
   the query?
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/sorting-posts-alphabetically-2/#post-1354194)
 * Hi sarcasteak,
 * > <?php
   >  $posts = query_posts($query_string . ‘&orderby=title&order=asc&posts_per_page
   > =10’); ?>
 * which file and where this code goes?
    I tried sidebar.php (default theme) and
   archives.php but it did not work.
 * thanks.
 *  Thread Starter [sarcasteak](https://wordpress.org/support/users/sarcasteak/)
 * (@sarcasteak)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/sorting-posts-alphabetically-2/#post-1354289)
 * Hi, I placed this before “the loop” used to retrieve posts in my category.php
 *  Moderator [t-p](https://wordpress.org/support/users/t-p/)
 * (@t-p)
 * [16 years, 4 months ago](https://wordpress.org/support/topic/sorting-posts-alphabetically-2/#post-1354310)
 * the default theme I use does not show any category.php, that’s why I tried in
   archive.php and then in index.php. But No difference in results.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Sorting Posts Alphabetically’ is closed to new replies.

## Tags

 * [alphabetically](https://wordpress.org/support/topic-tag/alphabetically/)
 * [sort](https://wordpress.org/support/topic-tag/sort/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [t-p](https://wordpress.org/support/users/t-p/)
 * Last activity: [16 years, 4 months ago](https://wordpress.org/support/topic/sorting-posts-alphabetically-2/#post-1354310)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
