Timed Announcement Shortcode for WordPress

Here is a simple shortcode that can be put in the functions.php file from the active WordPress theme. In the shortcode arguments you can specify starting time, ending time, title and title tag as well as the background colour and padding values for the div element that envelopes the announcment content.

Of course you are free to modify anything as needed.

Usage examples (remove the * character for the shortcode to work):

Result:

Announcement

This is some announcement with a H3 title as “Announcement” or its translation in another language



Result:

Announcement

This is some announcement with a H3 title as “Announcement” or its translation in another language and with light gray background



Result:

Announcement

This is some announcement with a H3 title as “Announcement” or its translation in another language and with only 10px padding instead of the default 20px



Result:

Result:

Result:

Some Title

This is some announcement with a H3 title as “Some Title” instead of the default title



Result:
Announcement

This is some announcement with a H6 title as “Announcement” or its translation in another language


Of course all shortcode arguments could be used together.

Enjoy!

Tags: ,

  1. Richard’s avatar

    Of course because we use background color argument, then we can also add color argument to change the color of the text inside the div element…

Reply

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

* Bifa GDPR este necesară

*

Sunt de acord

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Recommended Articles