While developing for speed-kini.de I came across the issue that people didn’t recognize change in the ranking on first sight. Thus I wanted to highlight entries which have been added in the recent days. WpDataTables has a feature called “conditional formatting” which allows you to apply css classes to cells under certain conditions.

Unfortunately these conditions are static. For my purposes I need a dynamic condition which considers the current date. After a bit of research I found a way how to highlight with a dynamic condition.
- Go to the wpDataTables settings. Scroll to the place where you can fill in custom JavaScript and CSS.
- Edit the JavaScript:
jQuery(document).ready(function( $ ) { $('.entry-date').each(function() { var dateString = $(this).text(); var parts = dateString.split("."); var date = new Date(2000 + parseInt(parts[2]), parseInt(parts[1])-1, parts[0]); var now = new Date(); var diff = parseInt((now - date) / (24 * 3600 * 1000)); if (diff < 3) { $(this).parent().addClass("new-entry"); } }); }); - Edit the CSS:
-
.new-entry{ color: green !important; font-style:italic; } - Update the column which contains your date parameter:

Add specified class to your column. The JavaScript isn’t the prettiest but it works so far. The result looks like this:

86 comments
https://t.me/Best_promocode_rus/1612
https://t.me/s/Beefcasino_rus/57
https://t.me/s/ud_1XsLOtS
https://t.me/s/UD_LegzO
https://t.me/s/tf_1win
https://t.me/s/official_1win_aviator/92
https://t.me/s/tf_1win
https://t.me/s/kfo_1win
https://t.me/s/ud_MOstBeT
https://t.me/s/Ud_gAMa
https://t.me/s/ud_jeT
https://t.me/official_1win_aviator/78
https://t.me/s/ke_Casino_X
https://t.me/s/ke_Jet
https://t.me/s/ke_GGBet
https://t.me/s/ke_kent
https://t.me/s/ke_MrBit
https://t.me/s/kef_Lex
https://t.me/s/ke_Pin_Up
https://t.me/s/ke_mellstroy
https://t.me/s/ke_Flagman
https://t.me/s/ke_Irwin
https://t.me/s/ke_Pinco
https://t.me/s/ke_Kometa
https://t.me/s/kef_Rox
https://t.me/s/ke_Pokerdom
https://t.me/s/ke_Gama
https://t.me/official_1win_aviator/201
https://t.me/s/ke_Drip
https://t.me/s/ke_Vulkan
https://t.me/s/ke_1Go
https://t.me/s/ke_JoyCasino
https://t.me/s/ke_DragonMoney
https://t.me/s/ke_Monro
https://t.me/s/top_kazino_z
https://t.me/s/topcasino_v_rossii