Title: Colour code management dates
Last modified: September 13, 2022

---

# Colour code management dates

 *  Resolved [shaikh441](https://wordpress.org/support/users/shaikh441/)
 * (@shaikh441)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/colour-code-management-dates/)
 * Hi,
    Recently I added some code into the Daily Email Schedule add-on, to colour
   code the key dates in the email body ([https://wordpress.org/support/topic/change-colours-in-email-template/](https://wordpress.org/support/topic/change-colours-in-email-template/))
 * Due within 30days – Green
    Due within 15days – Yellow Due less than 15 days/Overdue–
   Red
 * Not sure if this is a long shot, but I would like to know how I can apply this
   same colour code to the “Management” page on the WordPress dashboard, which also
   shows all key dates for all the properties. Either colour the text or the background
   of the text.
 * The code could be similar to the one added for email, but just need a pointer
   on where to start and more so which plugin file to edit.
 * Thanks!
    -  This topic was modified 3 years, 8 months ago by [shaikh441](https://wordpress.org/support/users/shaikh441/).

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Author [Property Hive](https://wordpress.org/support/users/propertyhive/)
 * (@propertyhive)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/colour-code-management-dates/#post-16008521)
 * The location where the date is output is here:
 * [https://github.com/propertyhive/WP-Property-Hive/blob/d5738269f1a8cb62ea5fb70b9023eccb24bce973/includes/admin/post-types/class-ph-admin-cpt-key-date.php#L180](https://github.com/propertyhive/WP-Property-Hive/blob/d5738269f1a8cb62ea5fb70b9023eccb24bce973/includes/admin/post-types/class-ph-admin-cpt-key-date.php#L180)
 * Obviously we don’t recommend modifying the core plugin and would instead suggest
   you use the ‘manage_key_date_posts_custom_column’ action instead in a custom 
   snippet outside of the plugin. An example of this action can be seen in the same
   file here:
 * [https://github.com/propertyhive/WP-Property-Hive/blob/d5738269f1a8cb62ea5fb70b9023eccb24bce973/includes/admin/post-types/class-ph-admin-cpt-key-date.php#L18](https://github.com/propertyhive/WP-Property-Hive/blob/d5738269f1a8cb62ea5fb70b9023eccb24bce973/includes/admin/post-types/class-ph-admin-cpt-key-date.php#L18)
 * Thanks,
    Steve
 *  Thread Starter [shaikh441](https://wordpress.org/support/users/shaikh441/)
 * (@shaikh441)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/colour-code-management-dates/#post-16008624)
 * 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
 *  Plugin Author [Property Hive](https://wordpress.org/support/users/propertyhive/)
 * (@propertyhive)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/colour-code-management-dates/#post-16009013)
 * 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](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
 *  Thread Starter [shaikh441](https://wordpress.org/support/users/shaikh441/)
 * (@shaikh441)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/colour-code-management-dates/#post-16009079)
 * 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
 *  Thread Starter [shaikh441](https://wordpress.org/support/users/shaikh441/)
 * (@shaikh441)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/colour-code-management-dates/#post-16012404)
 * 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
 *  Plugin Author [Property Hive](https://wordpress.org/support/users/propertyhive/)
 * (@propertyhive)
 * [3 years, 8 months ago](https://wordpress.org/support/topic/colour-code-management-dates/#post-16012516)
 * 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

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Colour code management dates’ is closed to new replies.

 * ![](https://ps.w.org/propertyhive/assets/icon-256x256.gif?rev=3206072)
 * [Property Hive](https://wordpress.org/plugins/propertyhive/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/propertyhive/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/propertyhive/)
 * [Active Topics](https://wordpress.org/support/plugin/propertyhive/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/propertyhive/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/propertyhive/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [Property Hive](https://wordpress.org/support/users/propertyhive/)
 * Last activity: [3 years, 8 months ago](https://wordpress.org/support/topic/colour-code-management-dates/#post-16012516)
 * Status: resolved