i cant get it to work. is somewhere samples ho to use this plugin?
try changing the first bit to
$hour = 0+date_i18n(‘G’)
which makes $hour an integer instead of a string so that the second bit works reliably. the other thing to check is to print out date_i18n(‘G’) somewhere (via a PHP widget would work) so you can check what your server thinks is the local time.
thanx, but i dont understand nothing from WP’s Conditional Tags – i’m total noob and found this code somewhere in wp forum. I try to use this in adrotate widget to show some ads only in nights, but i cant get it to work.
So now i tried:
$hour = 0+date_i18n(‘G’); if ($hour < 22 || $hour > 7 ) return true;
but it wont work for me…
it should definitely be && (that is ‘AND’) and not || (which is ‘OR’) to work. But if it’s not working then perhaps date_i18n isn’t working as expected on your install, and you’ll have to work out some way of checking what it is doing.
i made echo date_i18n(‘G’); and server time is correct. i tried to use logic in adrotate widget.. maybe adrotate wont work?
i give up, server time is correct…
code in wiget is correct as:
$hour = 0+date_i18n(‘G’); if ($hour > 22 && $hour < 7 ) return true;
and its not working