I recently wanted to add some random quotes to a newly created Oxwall website. After a quick review of available plugins I saw that to date there was no plugin that would create site wide random quotes. Rather than create a plugin which would have a learning curve attached to it, I decided to simply put the quotes into a script which I then added to the custom html widget.
Below are instructions on how to add a random quotes to an Oxwall website.
- Copy the following script:
quotes = new Array(7);
quotes = "True originality consists not in a new manner but in a new vision. Edith Wharton (1862 - 1937)";
quotes = "To be mature means to face, and not evade, every fresh crisis that comes. Fritz Kunkel";
quotes = "That's not a haircut. That's a cry for help.";
quotes = "Eliminate something superfluous from your life. Break a habit. Do something that makes you feel insecure. Piero Ferrucci";
quotes = "Some days it's just not worth gnawing through the leather straps.";
quotes = "We were born to unite with our fellow men, and to join in community with the human race. Cicero";
quotes = "Never regret something that once made you smile. Amber Deckers";
//calculate a random index
index = Math.floor(Math.random() * quotes.length);
//display the quotation
- Sign in to the admin area of your Oxwall website
- Click the Pages and Menus icon at the top of the page and then select User Dashboard from the drop down menu
- Click on the custom text/HTML icon on the right sidebar and move the widget to where you want it located by holding down the mouse and dragging the widget to the place you want it. I think the best place is probably above Newsfeed
- Click on the edit button at the right of the custom text/HTML widget
- Paste the code (copied in Step 1) into the Content (text/HTML) area
- Give your widget a name is you wish for instance Random Quotes
- Place a tick in the box
- Select a suitable icon from the drop down box entitled Add eg star
- Check Wrap in a Box
- Check Freeze. This will prevent any user tampering with the widget code but it will also stop them being able to move the box around the dashboard. Please note that if a user clicks on the Customize this page button the option to edit the widget will not be available to them.
- Click on Save. The widget will be highlighted in red to show that it has been frozen
- Go to Dashboard and if you have followed these instructions correctly you will now be able to see a random quote above the Newsfeed.
How To Add More Random Quotes to the Script
It is not difficult to add additional quotes or quotations to the script. Simply take the following steps:
- Decide on the number of quotes you require
- Change the following line to the number of quotes + 1. So for example if you want 10 quotes enter 11. Therefore change the line:
quotes = new Array(7);
quotes = new Array(11);
Hopefully you will find this Oxwall random quotes tutorial useful. If you enjoyed it please consider following me as I will be adding more Oxwall tutorials in the near future.