Join the Voxel Guide Community!

Get Involved

Highlight Current Day in Work Hours Widget

Description/Instructions

This is intended for someone using a child theme and is happy adjusting code / playing with code.

First off you need to find the work hours template file, it’s located in Voxel >> Templates >> Widgets (it’s called work-hours.php).  Then follow these steps:

1. Copy that file into the same hierarchy of your child theme (Child Theme >> Templates >> Widgets) – you will need to create the folders
2. Once the file is in there, open it and then find line 79
3. That is currently (v 1.5.2) a single

  • opening tag.
    4. Change that for the HTML below
    5. Once that is saved, copy the php code below for the functions.php and put it in there
    6. Copy the CSS below into your child theme or into the regular wordpress CSS section, but be sure to change the colours to match your branding.

  • Instructions

    This is the code to replace at line 79 (currently) of the work-hours.php file you have copied across to your child theme

    <li class="<?= $key === $today ? 'today' : '' ?>">

    • HTML
    Copy Code

    Instructions

    Here is the code to go into functions.php

    // Add a CSS class for highlighting today's day in the work hours table.
    add_filter('body_class', function($classes) {
    $classes[] = 'highlight-today';
    return $classes;
    });

    • PHP
    Copy Code

    Instructions

    Finally the CSS needed, be sure to change this to suit your branding

    /* Work Hour Amends */

    /* background color */
    .highlight-today .ts-work-hours-list li.today {
    background-color: #2A4635;
    }
    /* text colour of highlighted day */
    .highlight-today .ts-work-hours-list li.today p, .highlight-today .ts-work-hours-list li.today span {
    color: #FBF5D5 !important;
    }

    • CSS
    Copy Code

    Let's Chat About this Snippet

    Chat Toggle
    Voxel Guide AI
    Voxel Guide AI
    Voxel Guide AI
    Voxel Guide AI
    Ask me anything about Voxel!
    Send
    Powered by AI24