UX Design | Visual Design | Audio Design

Replace Voxel Dashboard Greeting With Random Greeting



Replace Voxel Dashboard Greeting With Random Greeting is a tiny snippet that you can add to your dashboard page template.

I found the static greeting on the Voxel dashboard a bit boring and added this fun snippet into my dashboard.

Here is how you can replace the Voxel dashboard greeting with a random greeting

#1: Add this snippet into the title text element of the “Greetings, username” field on the dashboard page template:

<div id="greeting">Hello<span id="name">, @user(:display_name)</span></div>

#2 Add this code into the dashboard page somewhere below this field, for example, through a WPcode snippet shortcode:

// Get alternative greetings
const alternativeGreetings = [
  "Hello there",
  "Hey there",
  "What's up",
  "Good day",
  "Guten Tag",
  "Dobry den",
  "Selamat pagi",
  "Nǐ hǎo",

// Get a reference to the element
const greetingElement = document.getElementById('greeting');

// Get a reference to the "Hello" part of the greeting
const helloPart = greetingElement.firstChild;

// Randomly select an alternative greeting
const randomIndex = Math.floor(Math.random() * alternativeGreetings.length);
const randomGreeting = alternativeGreetings[randomIndex];

// Update the content of the "Hello" part
helloPart.textContent = randomGreeting;

And that’s it. Have fun! 🙂

If you do not have Voxel yet, you can support me by getting it through this link: Get Voxel

And check out my other Voxel related blog posts!

If you like my tutorials and snippets, and want to motivate me, or just say thanks,
feel free to support me by buying me a tea (as I do not drink coffee) :)

This website may contain affiliate links. If you click on a link and make a purchase, I may earn a small commission at no additional cost to you. This helps support the time and effort put into maintaining this website. I only recommend products and services I genuinely believe will be helpful to you. Thank you for your support!