I have a directory where some entries pay to be “premium” and listed above other free entries. As a secondary sort level, all the premium entries are ordered by who became premium first, so older premium members retain their top spot when new ones are added.
I’m using a simple text input custom field with the “premium date” formatted like 2012-09-24. Whenever a new entry becomes premium I type the date in there. I then use this field to sort like this
orderby="is-premium|premium-date" sort="desc|asc"The problem with this is that entries with nothing entered into the premium date field showed above entries with a date, so I got around this by modifying the database to add a value of “0” to all empty fields with that field name. This made them come below all entries with any premium date.
My ongoing problem is that all new entries that are created must have a “0” value typed into that field, and I’d prefer not to have to look at the field at all unless a date is required. There are already a bunch of new entries with the date field value forgotten and editing them after the fact is a huge inefficiency.
I imagine there must be a batter way to do this. The problem I’m running into is that custom fields don’t allow you to specify a default value if the field is left blank. So regardless of the fieldtype empty fields will keep coming up above fields with a date specified.
I need a field type that will allow automatically fill the field with a default “0” value if it’s left blank. My understanding is that if you limit a field to a number or decimal only is may create a default value of “0”. Is this correct? But entering dates into a number only field would be cumbersome and hard to read.
Is there a date picker field that will allow for a default date?
Is there a better way to do this that I’m not thinking of?