How to add time greeting in your Joomla site

Maangatech > Web Design > How to add time greeting in your Joomla site

time greatings

Sometimes you need to add time greeting in your Joomla site like Good morning, Good afternoon, and good evening. In this tutorial, I will show you step by step toward adding time greeting in Joomla site.
Joomla site

  1. I hope you have the working Joomla site together with basic knowledge of using and manipulating Joomla.
  2. Download Sourcerer from (Sourcerer download) and install in your Joomla site by using extension manager. This will help us to be able to embed custom codes in Joomla site
  3. Navigate to Extensions->Module in your Joomla site and create new custom module to show greetings. At the top of the module editor there is new button from Sourcerer plugin that will help us to embed custom code in Joomla site labeled <> Code. Click it and you will see the snippet in a modal. Next, modify the snippet inside {source}…{/source} tag as shown below and click insert.

Copy the following snippet bellow and paste it between {source}…{/source} tag.

Welcome to my page. I would like to say:
<script language="JavaScript">
var myDate = new Date();
/* hour is before noon */
if ( myDate.getHours() < 12 ) 
    document.write("Good Morning!");
else  /* Hour is from noon to 5pm (actually to 5:59 pm) */
if ( myDate.getHours() >= 12 && myDate.getHours() <= 17 )
    document.write("Good Afternoon!");
else  /* the hour is after 5pm, so it is between 6pm and midnight */
if ( myDate.getHours() > 17 && myDate.getHours() <= 24 )
    document.write("Good Evening!");
else  /* the hour is not between 0 and 24, so something is wrong */
    document.write("I'm not sure what time it is!");
</script> </strong>
  1. Assign position to your module depending on your template positions and configure other options like title etc.

  1. Save your module and preview your site.

If you have followed all procedures correctly you will be able to see the result. If there is any question, suggestion or if it worked for you please let me know in the comment bellow. Thank you for visiting!

iexcel_post_nav(); ?>
0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments