2

Hey guys, I have a custom post type, portfolio, and I want to store the date of the projects. I can achieve it the "regular" way with a meta box but I would like a "datepicker" or something like it.

Any idea how?

1 Answer 1

1

Use the awesome time saving plugin Custom Field Template which uses a nice date picker (http://wordpress.org/extend/plugins/custom-field-template/)

it may be a bit odd to use at first, but once you get the hang of it it's very powerful. You can specify a custom meta box for just your custom post type.

Here is what you'd enter to get the date working.

[portfolio_date]
label = Portfolio Date
type = text
date = true
dateFormat = yyyy-mm-dd

the custom field is called portfolio_date

I change the date format so that it's easier to sort in queries. The default one is not good for sorting.

and if you need the date to start earlier than today's date add this

startDate = "2009-01-01" 
4
  • Already tried it. It doesn't work because the only dates available are from today to any days forward. Imagine I've completed a projected last year on March, then (or "than"? My english isn't so good) I want to display something like: "Project title: ProjectX Date: March/2010." Mar 18, 2011 at 19:27
  • you need to set the startDate option, then it will start with the date you specify.
    – dwenaus
    Mar 18, 2011 at 19:29
  • for example: startDate = "2009-01-01" will give you two years to play with
    – dwenaus
    Mar 18, 2011 at 19:30
  • it looks like you can use other options as well. for exmaple this in the options list: endDate = (new Date()).asString() is js i believe
    – dwenaus
    Mar 18, 2011 at 19:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.