Title: Advanced Post Sorting
Last modified: August 19, 2016

---

# Advanced Post Sorting

 *  [stonefree](https://wordpress.org/support/users/stonefree/)
 * (@stonefree)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/advanced-post-sorting/)
 * I am using the Gigs Calendar plugin for a DJ website. Rather than the plugin’s
   standard table of events, I am using a WP_Query call to display all posts with
   Category_name=Events .Works great except I need to sort them in according to 
   the show date. The date is the first thing in the title. See [here](http://www.hectorworks.com/events/)
 * Here is the template page code
 *     ```
       <?php
       /*
       Template Name: Events
       */
       ?>
       <?php get_header(); ?>
       	<div id="content">
           <div class="post-inner">
   
       <?php
       $loop = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 10 , 'category_name' => 'Events' ));  
   
       	?>
       	<?php while ( $loop->have_posts() ) : $loop->the_post(); 
   
       ?><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
       <?php the_title();?></a></h2><?php	
   
       	the_content ();
   
       	endwhile;?>
       	<?php // do_shortcode ('[gigs-calender archive]');?>
       	        </div><!-- #content -->
       	        <?php if (have_posts()) :
       	while (have_posts()) : the_post();
       	the_content ();
       	endwhile;
       	endif;
       ?>	        </div>
   
       <?php get_sidebar();?>
       <?php get_footer(); ?>
       ```
   
 * I’m thinking something along the lines of reading the initial string of the title,
   converting it to a date, then resorting the WP_Query but not sure how to do it.
   Can anyone help? Would also like to have a divider for events that have already
   happened.

The topic ‘Advanced Post Sorting’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [stonefree](https://wordpress.org/support/users/stonefree/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/advanced-post-sorting/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
