sorting posts by custom date field not recognizing the date format
-
I’m making a site where on one page I need to display two individual loops from different categories. All is working fine except the posts have to be sorted by their custom field value which is a date.
Here is the loop i’m using:
<?php $project_date = get_posts('category=8&numberposts=30&order=ASC&orderby=meta_value&meta_key=Dato'); foreach ($project_date as $post) : setup_postdata($post); $dato = get_post_meta($post->ID, 'Dato', $single = true); $type = get_post_meta($post->ID, 'Licitationstype', $single = true); ?>
But somehow It won’t sort the dates correctly. The site is in Danish and the dates have to be in this format: 25. august 2009 (‘j. F, Y’). I have written them this way in the custom fields, but this is what comes up:
18. august 2009
19. august 2009
2. september 2009
24. august 2009
25. august 2009I looks like it’s sorting them based on the first number and ignoring the month. So I’m wondering how to tell the loop that the value is a date?
Any help on this will be so very much appreciated!!!!!!!
- The topic ‘sorting posts by custom date field not recognizing the date format’ is closed to new replies.