Title: timed widget
Last modified: August 20, 2016

---

# timed widget

 *  [pyrohot](https://wordpress.org/support/users/pyrohot/)
 * (@pyrohot)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/timed-widget/)
 * If i want to show widget from 23.00 till 06.00 in morning, then is this code 
   correct?
 * $hour = date_i18n(‘G’); if ($hour > 22 && $hour < 7 ) return true;
 * [http://wordpress.org/extend/plugins/widget-logic/](http://wordpress.org/extend/plugins/widget-logic/)

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

 *  Thread Starter [pyrohot](https://wordpress.org/support/users/pyrohot/)
 * (@pyrohot)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/timed-widget/#post-3373671)
 * i cant get it to work. is somewhere samples ho to use this plugin?
 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/timed-widget/#post-3373674)
 * 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.
 *  Thread Starter [pyrohot](https://wordpress.org/support/users/pyrohot/)
 * (@pyrohot)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/timed-widget/#post-3373675)
 * 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…
 *  [alanft](https://wordpress.org/support/users/alanft/)
 * (@alanft)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/timed-widget/#post-3373677)
 * 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.
 *  Thread Starter [pyrohot](https://wordpress.org/support/users/pyrohot/)
 * (@pyrohot)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/timed-widget/#post-3373694)
 * i made echo date_i18n(‘G’); and server time is correct. i tried to use logic 
   in adrotate widget.. maybe adrotate wont work?
 *  Thread Starter [pyrohot](https://wordpress.org/support/users/pyrohot/)
 * (@pyrohot)
 * [13 years, 3 months ago](https://wordpress.org/support/topic/timed-widget/#post-3373749)
 * 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

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

The topic ‘timed widget’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/widget-logic_c8dde5.svg)
 * [Widget Logic](https://wordpress.org/plugins/widget-logic/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/widget-logic/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/widget-logic/)
 * [Active Topics](https://wordpress.org/support/plugin/widget-logic/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/widget-logic/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/widget-logic/reviews/)

 * 6 replies
 * 2 participants
 * Last reply from: [pyrohot](https://wordpress.org/support/users/pyrohot/)
 * Last activity: [13 years, 3 months ago](https://wordpress.org/support/topic/timed-widget/#post-3373749)
 * Status: not resolved