CMS & WordPress
rpeg — 2012-01-12T18:43:55-05:00 — #1
I may have made a poor decision but I have some custom fields in Wordpress that allow users to input numbers for a month, day and year. I wanted this separate from the publish date fields in WP because I felt this would be easier and because the client has lots of older content they need to publish.
So how can I query and order by meta fields or what is the best way to do this? order by the day, month and year fields, all of which contain numbers.
Thanks in advance.
rguy84 — 2012-01-13T10:45:38-05:00 — #2
I would tell them to use the publish field, and type in the [old] dates by hand. If you have 5 posts and they were dated in the last week, withe the newest at #1. Publishing it with a date of Dec 23, 2011, will put it at #6 not #1.
rpeg — 2012-01-13T11:40:29-05:00 — #3
So is that generally the best way to go about it? Part of the reason I set it up this way was because sometimes articles are published that have different dates from when the WP post is published so I created these fields to differentiate.
rguy84 — 2012-01-13T12:18:49-05:00 — #4
You can make the WP publish date anything from either 1-1-1900 or 1970 to 12-31-9999, this is a MySQL limitation. @r937 would know the answer.
Are you bringing the old content in to have it all there (like archiving) or do you want to push the content as new and just be able to say give me stuff originally written in 2005?
r937 — 2012-01-13T12:40:32-05:00 — #5
sorry, no idea, i don't do wordpress
rguy84 — 2012-01-13T12:44:15-05:00 — #6
Rudy, my throw to you was the date ranges in MySQL.
r937 — 2012-01-13T13:05:29-05:00 — #7
date ranges depend on which datatype is being used to store the date, and as i said, i don't know wordpress, so i don't know which of the 4 different ways of storing dates applies here
da manual is the best reference for datatypes
rguy84 — 2012-01-13T13:17:06-05:00 — #8
Oh ok, I didn't realise that there were 4.
rpeg — 2012-01-13T17:03:38-05:00 — #9
The datatype is a text field for month, day and year. I assumed there could be a way to read those as numbers and have some formula to be able to organize it appropriately.
rguy84 — 2012-01-17T13:57:14-05:00 — #10
Rpeg, can you answer the question I asked in #4?
mittineague — 2014-09-25T00:14:45-04:00 — #11
This topic is now archived. It is frozen and cannot be changed in any way.