Forums › Forums › Search & Filter Pro › search form with post POST META (date and time)
- This topic has 6 replies, 2 voices, and was last updated 10 years, 3 months ago by Ross.
-
Anonymous(Private) July 30, 2014 at 1:27 pm #3075
Hi,
I have a problem in a search form with post meta field.I use:
1. WordPress 3.8.3
2. Search & Filter Pro plugin 1.1.6
3. Custom fields (Date and Time in this format mm/dd/yy) created by Custom Content Type Manager : Advanced Custom Post Types (Vers 0.9.7.13)The filter works perfectly but if I add a POST META field by search it is ignored.
What there can be a problem?
Ross Moderator(Private) July 31, 2014 at 1:37 pm #3079Hey gianfranco – what format is the date stored in the database? The date must be stored as either a timestamp, or YYYYMMDD – these are the only formats for saving in the database that are supported currently.
Ross Moderator(Private) August 11, 2014 at 1:27 pm #3386Hey gianfranco
Do you mean the display format from the plugin, or the backend format that is saved in the database? Frontend is not too difficult..
The date format in the backend must match a format that can be compared numerically directly from the database – so we can perform searches.
For example if you wanted to find posts within a date range, then the database query would look something like (this is extremely simplified):
SELECT * FROM 'posts' WHERE datefield < '20140601' AND datefield > '20130101'
Basically we have to be able to use operators like “greater than” and “less than” and this is only possible with numbers – not strings (so you cannot add regular characters such as hyphens).. this is also possible with a unix timestamp which is currently supported.
Does that make sense?
-
AuthorPosts