Title: Sorting Posts by Date or Timestamp?
Last modified: August 18, 2016

---

# Sorting Posts by Date or Timestamp?

 *  [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/)
 * Ok I asked this before regarding something else, but I’ll try my luck with a 
   new post :o)
 * ::::::::::::::
 * Ok here is what I WANT to do:
 * I post a show Today for NEXT WEEKEND. I want that show to get organized by date
   to fit in with the other current listings. Is there a way to sort by DATE or 
   by CATEGORY ID?
 * My thing is that I have a lot of SHOWS listed here:
 * [http://www.foxvalleyshows.com/new/shows.php](http://www.foxvalleyshows.com/new/shows.php)
 * I want to show visitors these shows AHEAD of time so they can plan on going to
   them. But say if someone wants another show posted between 2 existing shows? 
   That makes me think that sorting by category ID is NOT going to work.
 * So is there any way of sorting by the TIMESTAMP? I mean the data is there, as
   I will change the timestamp for each new post, so there has to be a way of using
   that data to organize the POSTS right??
 * I did find this post:
 * [http://wiki.wordpress.org/?pagename=HowToChangeSortOrder](http://wiki.wordpress.org/?pagename=HowToChangeSortOrder)
 * But that only sorts the actual WP index.php page and not any other page. So you
   guys can see that I am definately trying to figure this out on my own, but nothing
   is working.
 * I even took this code:
 * $orderby=”date”; $order=’ASC’;
 * and placed it on my shows.php page on top like this:
 * <?php $orderby=”date”; $order=’ASC’; require(‘./news/wp-blog-header.php’); ?>
 * But that didn’t work either.
 * I am using this code under the Upcoming Shows section on all of my pages:
 * <?php $posts = get_posts(‘numberposts=40&offset=0&category=1’); foreach($posts
   as $post){ ?>
    <?php the_title(); ?> <?php the_excerpt(); ?> <?php the_content();}?
   >
 * I am using this code under the main section of my shows page:
 * <?php $posts = get_posts(‘numberposts=40&offset=0&category=1’); foreach($posts
   as $post){ ?>
 * <?php the_date(”,'<h2>’,'</h2>’); ?>
 * <h3>
    <?php the_title(); ?> <br> <span class=”upcoming”> <?php the_excerpt();?
   > </span> </h3> <?php the_content();} ?>
 * You can view the actual page here:
 * [http://www.foxvalleyshows.com/new/shows.php](http://www.foxvalleyshows.com/new/shows.php)
 * I am just trying to sort the listings better…
 * -Mark

Viewing 15 replies - 1 through 15 (of 30 total)

1 [2](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/page/2/?output_format=md)

 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-232924)
 * Aren’t the “date” and the “timestamp” the same thing? Any post is associated 
   with a dtae (and by default WP displays the posts in a chronological order according
   to the date) and with the “timestamp” editing you can change the date associated
   with the post, so it will be displayed according to the “new” date…
    At least
   this is how I understand it works. And, yes, I did change the time in this way
   on some of my posts.
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-232928)
 * That is mostly true. The problem I am having is that I want the “shows” listed
   by the DATE OF THE SHOW and not by when I made the post. That is what I am trying
   to figure out how to do. I don’t know if need a plugin (which by the way I only
   found a Category one that I can sort by ID Number) or just some simple code (
   which I have also already tried doing).
 * I wish I could just sort the “shows” with the timestamp, if I could do that then
   that would solve the sorting issue.
 * Any ideas on how I could do this?
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-232929)
 * Sorting the posts by the “timestamp” is the same as sorting by the date when 
   you made the post. That’s what I am trying to explain 🙂
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-232932)
 * But I am manually editing the timestamp when I make the post under the Advanced
   Posting Options…so why can’t WP sort them based on that?
 * When I do manually edit the timestamp that particular post does not show up. 
   From what I could gather is that when you edit the timestamp then that particular
   post won’t show up until that date. For example, if I make a post today for a
   show on 8/8/2005 and edit the timestamp to Aug 8 then that post won’t SHOW UP
   until 8/8. That I don’t want. I want that show posting to show up today but be
   organized along with the other posts by date.
 * Make sense?
 *  [moshu](https://wordpress.org/support/users/moshu/)
 * (@moshu)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-232933)
 * It makes sense, but you just don’t listen 🙂
    Editing the timestamp = editing
   the publish date.
 *  [amory](https://wordpress.org/support/users/amory/)
 * (@amory)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-232936)
 * Check out [Event Calendar 2](http://blog.firetree.net/2005/05/27/eventcalandar23/).
   Under its options in the admin area, select your shows category. From there you
   can call a list of upcoming shows, as well as having the option to display a 
   calendar. You may need to modify the script depending on what you want to display(
   excerpts etc…). If you do, I can help you with that, as I just heavily modified
   my own version of it for a band website.
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233133)
 * Moshu- I understand and was listening…my question was could i change the way 
   WP would post the publish date (timestamp) and I know that the answer is NO. 
   So I didn’t know if there was a workaround that. No biggie :o)
 * Amory- Thank you for the information and I have the calendar installed. The calendar
   is a good idea, but I’ll need to do some tweaking to it to make it do what I 
   want. I am looking at basically setting it up where it has:
 * the title
    the excerpt the content
 * And with no links to the actual WP posting, at least for now. I LOVE how it is
   sorted via date. That rocks! That’s what I have been trying to do for a few days
   now.
 * Do you have any suggestions for me to get this up and running the way I want?
 * On the [http://www.foxvalleyshows.com/new/shows.php](http://www.foxvalleyshows.com/new/shows.php)
   I like how it has the listings and would be happy (for now) with that same type
   of format. I looked briefly at the plugin code but, aside from editing the plugin,
   am not sure if I can call “the_content” on my template page. Any ideas?
 * I am basically going for this idea here with my site:
 * [http://www.syracuseshows.com/upcoming.php](http://www.syracuseshows.com/upcoming.php)
 * So I’d like to have images posted similar to what this guy has. But again would
   settle for how the MY current shows.php page looks too.
 * -Mark
 *  [amory](https://wordpress.org/support/users/amory/)
 * (@amory)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233146)
 * That will be fairly simple. Why do you want to display both the excerpt and the
   content?
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233151)
 * Yes basically how the shows.php page looks now in the main section. Having options
   to change the outputting HTML code would be nice too:)
 * Let’s maybe get this then add some cooler things later…
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233153)
 * Sorry didn’t read your post correctly…
 * For the time being I am trying to avoid using WP for visitors to view posts. 
   I am mainly using WP as a basic content management system. So if I can use WP
   to post shows and news and take that data, and pull it into my site (like I am
   doing now) and then organize the shows by date, that is all I am attempting to
   do.
 * So I would need the content and excerpt and title pulled.
 * Does that help?
 *  [amory](https://wordpress.org/support/users/amory/)
 * (@amory)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233155)
 * Download: [Link](http://bluewebpages.com/downloads/eventcalendar2.phps)
    Funciton:`
   <?php ec2_get_events_list(); ?>` It currently outputs as an unordered list with
   classes per each part for you to style.
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233188)
 * Awesome this looks like it is going to work better, I still have to play around
   with it, I ended up using:
 * <?php ec2_get_events_list(5,’j F’); ?>
 * As I was getting errors before with just the code you gave me.
 * I have to remove the `<li>` stuff now too and see about adding `<b>` tags for
   the title….
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233205)
 * Has anyone seen this:
 * Warning: Cannot modify header information – headers already sent by (output started
   at /home/.sites/95/site92/web/new/news/wp-content/plugins/eventcalendar2.php:
   536) in /home/.sites/95/site92/web/new/news/wp-admin/admin.php on line 10
 * Its after I changed the plugin and reuploaded it…do I need to rename the plugin
   or something?
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233213)
 * I’m only getting that error on lines 10, 11, 12 and 13. Did you test out the 
   code you gave me Amory?
 * I did try deleting the whitespaces but that didn’t clear it up…
 *  Thread Starter [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * (@encryptdesigns)
 * [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/#post-233216)
 * My bad….I missed a whitespace :o) I have it working again and trying to edit 
   it again…

Viewing 15 replies - 1 through 15 (of 30 total)

1 [2](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/page/2/?output_format=md)

The topic ‘Sorting Posts by Date or Timestamp?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 30 replies
 * 4 participants
 * Last reply from: [Mark](https://wordpress.org/support/users/encryptdesigns/)
 * Last activity: [20 years, 11 months ago](https://wordpress.org/support/topic/sorting-posts-by-date-or-timestamp/page/2/#post-233498)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
