As descibed in-depth on SitePoint a hello bar is a thin bar of content that slides into view once the user scrolls past a set point on a page.
The message content is up to you, but is ideal for advertising, product annoncements or other messages.
This plugin provides an admin interface to create multiple hello bar messages that can then be randomly displayed on user facing pages.
By setting weightings for each message you can determine how often each is displayed. On each page load a message is randomly selected
(respecting the weightings given). A random number is generated client side before fetching the message content to ensure it is compatible
with caching services such as W3 Total Cache.
npm module for you to include in your own scripts.
- Upload the entire
/sp-random-hello-bar/folder to the
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Navigate to the SP Random Hello Bar section of the Settings menu. At
example.comthis page would be found at
- Enable the hello bar to display in pages.
- Select if you would like to enqueue basic css styles fror the hello bar.
- Enter content for one or more hello bars and set a weighting.
Sure. The plugin contains the SpHelloBar source as an ES6 Module at
src/js/SpHelloBar.jsand as a common.js module at
The SpHelloBar module does not have any external dependencies but it would then be up to you to provide a throttle function and to load the hello bar content into the page (usually via ajax).
However the Basic and Basic with storage scripts assume that jquery and underscore have been enqueued. Those two libraries are enqueued in the default setup of WordPress unless you have dequeued them.
- Can I customise the content?
Go for it. The basic scripts assume the default css class names are being used but the only one that is required is
when writing your own script.
- How did you build something so wonderful?
I’m glad you asked. You can read about how it was put together on SitePoint.
There are no reviews for this plugin.
Contributors & Developers
“SitePoint Random Hello Bar” is open source software. The following people have contributed to this plugin.Contributors
Translate “SitePoint Random Hello Bar” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
- Submitted to WordPress for approval
- Added assets
- Ready for use