Thanks for your quick response.
How would I utilise the “manage_key_date_posts_custom_column”? Is it done through a “Code Snippets” plugin?
Below is the code added to the email template to colour code the dates:
$schedule_start_date = new DateTime($start_date);
$interval = $schedule_start_date->diff($due_date);
if ( $interval->format('%R%a') <= 30 && $interval->format('%R%a') > 15 )
{
// due in 30 days - green
$details = '<span style="color:#090">' . __( 'Due', 'propertyhive' ) . ' ' . $due_date->format('jS M') . '</span>';
}
elseif ( $interval->format('%R%a') <= 15 && $interval->format('%R%a') >= 0 )
{
// due in 15 days - yellow
$details = '<span style="color:#FFFF00">' . __( 'Due', 'propertyhive' ) . ' ' . $due_date->format('jS M') . '</span>';
}
elseif ( $due_date < $schedule_start_date )
{
// was due in the past - red
$details = '<span style="color:#900">' . __( 'Originally due on', 'propertyhive' ) . ' ' . $due_date->format('jS M') . '</span>';
}
Can something to the same effect be used to achieve the same results on the dashboard management page?
Thanks again
I’ve put together the following for you which can be added through the Code Snippets plugin as you mention:
https://gist.github.com/propertyhive/bf67a6918970f742cc6544d020261a13
This will add a new column to the management grid containing the colour-coded date, similar to the email schedule.
Note that the above is untested and is just meant to act as a starting point. Hopefully it’s enough to go on.
Steve
Brilliant, thanks very much for your prompt support! One of the many reasons I continue to utilise this plugin 🙂
I will run this through a test environment and give it a go
I have run it through some testing and found I needed to remove the “public” parameter from the function for it to work correctly.
I see the script adds a new column which is fine, however if I wanted to use the existing columns (e.g Date Due) and add the relevant colours with the dates already listed there (still calculating due within 30 days etc), is this something that needs to be done differently with different hooks?
Thanks
I’m afraid it won’t be possible to use the existing column, hence why a custom new column has been created in that snippet.
You can hide the existing column using ‘Screen Options’ in the top right. Should you wish to re-order the columns there are third party plugins out there that allow you to do this.
Steve