WordPress – unregister widget between 17:00 hrs to 05:00 hrs using FUNCTION.PHP file

My code in function.php

if ((date('H') > 17) && (date('H') < 05)) {
    $text-12 = "text-12";
    unregister_sidebar( $text-12 );
}

WordPress structure code;

<div id="widget-area-2" class="site-sidebar widget-area" role="complementary">
<aside id="text-12" class="widget widget_text">
<div class="textwidget">
OFFICE IS CLOSED NOW
</div>
</aside>
</div>

Read more here: WordPress – unregister widget between 17:00 hrs to 05:00 hrs using FUNCTION.PHP file

Leave a Reply

Your email address will not be published. Required fields are marked *