Forums

[resolved] how to hide and display specific widget at certain time (timetable) (5 posts)

  1. vigilant_spb
    Member
    Posted 1 year ago #

    hello people

    help me please, it's necessary to show one widget (free text) only at daytime and hide it for all the night.. how can I do this automatically?

  2. vtxyzzy
    Member
    Posted 1 year ago #

  3. vigilant_spb
    Member
    Posted 1 year ago #

    how can I put proper condition? like "show this widget only from 9 to 18 oclock"?

  4. vtxyzzy
    Member
    Posted 1 year ago #

    For daylight (from 9 thru 18), you can use this:

    $hour = date_i18n('G'); if ($hour > 8 && $hour < 19 ) return true;

    For dark (0 thru 8 or 19 thru 23), use this:

    $hour = date_i18n('G'); if ($hour < 9 || $hour > 18 ) return true;

  5. vigilant_spb
    Member
    Posted 1 year ago #

    2 vtxyzzy: you're genius!! it works, great thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags