August 2nd, 2009
How to include random taglines in your Wordpress blog
After trying out three different random tagline plugins across various themes, I’m forced to conclude that including one in your WordPress blog is a Very Complicated Business.
Ergo! (Ergot?) A tutorial forthwith!
This is a modified version of the instructions that come with Clark Consulting’s generalized PHP random quote script that is not designed for WordPress, but available for use with all PHP sites.
Audience level:
Beginner
You will need:
- The latest version of QuoteMe (currently at 4.1 as of this writing)
Recipe:
- Upload to a directory (doesn’t have to be in WordPress) on your webserver.
- CHMOD “quotes.txt” to 766.
- In “inc.php” replace
$myUsername = "YOURUSERNAME"; $myPassword = "YOURPASSWORD";
with secret username & password of your choice (read on though, you might end up deleting certain files and not need this).
- In “inc.php” replace
$dbFileName = array("/quote/quotes.txt");with the path to folder containing the script.
- Go to “quotes.txt”. Start filling in your taglines, one on each line, appended with three vertical bars right afterwards, no spaces. Like so.
This tagline goes here 1.||| This tagline goes here 2.||| This tagline goes here 3.|||
- It states in “HowToInstall.txt” that references (who said the quote) are a required field. They’re not, if you remove the formatting the makes it appear as a quote. Go back to “inc.php”. Replace the line that says
$quoteHTML = "<div align='center'>".$myQuote." - ".$myLink."</div>";with
$quoteHTML = "".$myQuote."";
- In the appropriate template of your current theme (I usually do this in “header.php”), replace
<?php bloginfo('description'); ?>with
<?php include('pathname/display.php'); ?>Remember, you don’t need to start it with a slash.
- It should work! Refresh a couple of times to see.
- I just showed you how to update the flat file of quotes without a need for going through the administrative interface. You can actually delete “style.css”, “logout.php”, “manage.php”, “view.php”, “sampleQuotes.txt”, and the images folder — logging in’ll just bring you to 404. I’d recommend keeping “index.php” to keep people from peering into your directory, “display.php” to test whether it’s working, and “HowToInstall.txt” just for general reference.