Join GitHub today
Add post date control and preview #202
Update - 28 Jul 2:30 PM ET
This control has been improved and refactored significantly over the last few days, especially in light of Weston's comments.
I opted to deal with the post_date specifically (as opposed to post_date_gmt) because post_date timezones are easily converted in WP using
In light of this, the JS has been greatly pared down because there isn't so much use of JS
Directly updating the post_date_gmt and post_status is no longer done in this control's JS. Now,
A couple of points for improvement:
Update - 26 Jul 11 PM ET
I've got the basic functionality working as an extension of the Dynamic control. This is found in
I am using JS's
There are two new JS
The custom template for the inputs is found in
The current implementation saves both
I'm looking to see if I'm on the right track with my work on the Post Date UI. This is my first time working heavily with the customizer in JS, and my first issue with Customize Posts, so this may be a bit clunky.
My goal is to take the post_date and split it up into separate inputs just as it is in the Post Edit screen.
in the Customizer, when any input is changed, it updates a hidden field, then that value is passed over to the preview pane. This way, we don't have to save each piece of the date (like the month, day, year, etc).
I've added a new scheduled countdown to appear with the timezone information when the status is
If the time status is
And again, you can reset the time to be empty so that it will update with the current time (notice placeholders). As noted above, clicking this button will cause the
In these examples, notice that I've moved the description below the input fields. I'm still very much unhappy with how I've “designed” the info under the control. I don't like how the description and the reset button look. They should perhaps be collapsed by default in some