Via the Webs

Business Hours Indicator

How to Use
Download > Install > Activate. To edit, use your favorite IDE or just edit within the WordPress plugin editor. Change the open and close times to suite your needs. Times are based on server time so adjust accordingly.

Example
In the code below I am open 9-5 mountain or 16:00 – 11:59 UTC (server time). The last line of the code allows for the short code to be used within a WordPress menu which is displayed in my header.

Source
This code can be pasted into the functions.php file of your child theme or, download and install the plugin for simple code activation.

/*
Plugin Name: Lightweight Plugins - Business Hours Indicator
Plugin URI: https://lightweightplugins.com/plugin/business-hours-indicator/
Description: A lightweight plugin that adds a little open / closed pill with colors.
Version: 1.6
Author: WP Maintenance Experts
Author URI: https://wpmaintenanceexperts.com/
License: GPLv2 or later
*/

function build_lighweight_business_hours_indicator_shortcode(){
$now = new Datetime("now");
$opentime = new DateTime('16:00');
$closetime = new DateTime('23:59');

if($now >= $opentime && $now <= $closetime){
    // between times
    $output = '
Open
'; } else { // not between times $output = '
Closed
'; } // $output = '
' . $now . '
'; //uncomment line to see current server time return $output; } add_shortcode( 'lwopenclose', 'build_lighweight_business_hours_indicator_shortcode'); add_filter('wp_nav_menu_items', 'do_shortcode');

Plugins Articles

Disable XML-RPC

Disabling XML-RPC in WordPress can be beneficial for several reasons: Security Concerns: XML-RPC has been targeted by attackers in various types of malicious activities: Brute Force Attacks: Attackers can use XML-RPC to amplify their brute force attacks. Instead of...

read more

MS Clarity Exclude Logged In Users

How to Use Download > Install > Activate. Use your favorite IDE or just edit within the WordPress plugin editor. Change "xxxxxxxxxx" to be your Clarity ID. Not associated with Microsoft® Clarity® Example This prevented me from recording all my logged in back-end...

read more

Add to Console Log

How to Use Download > Install > Activate. Use your favorite IDE or just edit within the WordPress plugin editor. Change the message to suit your needs. Example A fun project plugin. Thought of this after discovering a software company had a message about their open...

read more

Most Recent Articles