The current situation
The plugin I'm currently working on is an additional post list view: A calendar, as you can see in the following screenshot.
Admin calendar view with MP6 and handheld screen width.
Now each day shows the amount of posts only.
What I want to add is a link to add a new post. But this link should not only take you to the
~/wp-admin/post-new.php?post_type=abcscreen, but as well add a predefined post date - the one from the day where you clicked on.
The possible solutions and problems
So far there're several options:
- Hook into the publish meta box and try to modify the date somehow.
- Remove the meta box, make a clone of it and just replace the date to accept data from a query variable (@Rarst idea).
- Add a draft with a custom post status and predefined date upon click on "new"-link, redirect to the draft. Clean up drafts with a wp cron job (@userabuser idea).
- Hooking into the meta box means adding a callback to the
preview_post_link-filter. Then I'd attach another callback to intercept the
gmt_offset-option with a
'pre_option_gmt_offset'-filter just to change the calculation done inside
touch_time()to return the current date. Problem is that the calculation is
time() + ( $offset * HOURS_IN_SECONDS );and the only value one could change is
- Replacing the meta box would mean keeping track of every trac ticket and core change and therefore wouldn't be much future proof.
- A lot of effort to add drafts, clean them up, etc. Then there's the problem that using custom post status still is a field full of mine traps.
Any idea appreciated. Code that proofs the concept even more. I'll announce a bounty as soon as there're some usable drafts as answers.