With the rampant rise of plagiarism, lawsuits, and just the general state of affairs around the blogosphere it seems that sooner rather than later, every blog should put up a Legal Notice / Terms of Use page. A Legal Notice page for your blog is like alarm company stickers on the windows of your house, they doesn’t really do anything other than alert visitors that you mean business. Professional burglars are still going to break in and steal things just as unscrupulous Internet visitors / scrapers continue to repost your content with their ads. At least you are giving the bad guys the heads up that you are serious about your work.
My current legal notice is copied from Elliott Back (by his permission). I changed the name and website in the text of the notice and added my own little blurb about RSS use and the theme that provides the look of this website (sawchuk). Once written the way I liked, I then published Legal Notice as a WordPress page (instead of a regular post).
Now, its all fine and dandy that the Legal Notice had been published, but I wanted it to be visible at the bottom of every page ever published on MaxPower.ca. I wrote a quick plugin to do the job and I thought that maybe others would find it interesting as well. So here is a quick how to / how it works:
There are really three ways to make a legal notice / TOS pervasive (spread throughout):
- edit the current WordPress template to include it wherever you like
- put it in your blogroll
- create a simple WordPress plugin
The big problem with doing #1 is that if you ever change your WordPress theme than you will have to remember to make the link again in the new theme (something I have often done). In addition, editing a WordPress template is very daunting for most WordPress users — looking at a long code page can easily scare away most novices.
#2 is easy to implement but it sort of mixes up things; most people use their blogroll to link to other sites that they value so it seems strange to include a link to your own page in a list of links to other pages. Not only that, but (for the most part) blogrolls are kept in the sidebar, what if you want the legal notice link somewhere else? I want the link to be in the footer of every page. The footer is an out of the way part of every webpage where users who want to know copyright TOS stuff will look. Every big company has a legal notice of some kind, and its almost always available via the footer — why break with tradition?
This leaves #3, creating your own WordPress plugin. This sounds really difficult — but it’s not. All that’s needed is the automatic insertion of a link in the footer of every page. To accomplish this all you need a tiny bit of information on using the WordPress plugin API and a text editor.
WordPress runs using PHP, so that is the scripting language shown below. Every WordPress plugin starts out with the same basic 6 lines. The lines (plugin name, plugin URI, description, etc) are self explanatory and can be set to anything you like. The only thing to make sure of when making a new plugin is that you don’t give it the same name as another plugin that already exists. WordPress needs to know which plugin is which.
/*
Plugin Name: Stupid Simple Insert Legal Notice
Plugin URI: http://www.maxpower.ca/plugins/
Description: Automatically add the legal notice into the footer of every page
Version: 0.1
Author: Kirk Montgomery
Author URI: http://www.maxpower.ca
*/
After this a PHP function is created. A function is basically a chunk of PHP code designed to do a single task and most importantly, the code contained within a function is ignored until called from another part in the script. In the case below, the function is called SSILN_footer and all it does it create a link. Like the plugin name mentioned above, a function can be called anything you want, but don’t name two alike or they’ll be problems. Naming the function something unique gets around this potential issue.
function SSILN_footer() {
$mylegalnotice = 'http://www.maxpower.ca/about-maxpower/terms-of-use-legal-notice/';
echo '<a href="' . $mylegalnotice . '"/>Legal / Terms of Use</a>';
}
The function SSILN_footer creates a link by taking the value of $mylegalnotice (http://www.maxpower.ca/about-maxpower/terms-of-use-legal-notice/), and echoing (or outputting) that value surrounded by the appropriate HTML (A HREF) to create link. Now that we have a simple function, we need to tell WordPress that we want it to execute that function in the footer. This is done using the add_action function as part of the WordPress plugin API.
add_action('wp_footer', 'SSILN_footer');
In the code above, the function add_action is a ‘hook’ to notify WordPress that when a page is to be served to an Internet visitor, it should also execute the function SSILN_footer in the WordPress footer. In essence, add_action asks WordPress to insert the result of SSILN_footer in the WordPress footer.
Thats it! Here is the completed script with a little bit of extra information to make it clear for anyone to use. You can download it below.
[php]
< ?php
/*
Plugin Name: Stupid Simple Insert Legal Notice
Plugin URI: http://www.maxpower.ca/plugins/
Description: Automatically add the legal notice into the footer of every page
Version: 0.1
Author: Kirk Montgomery
Author URI: http://www.maxpower.ca
*/
function SSILN_footer() {
//
// Edit the value of $mylegalnotice to correspond to the published WordPress
// page (or post) where your legal notice is found.
// Example: http://www.maxpower.ca/about-maxpower/terms-of-use-legal-notice/
// Be sure to keep the URL in single quotes
//
$mylegalnotice = 'http://www.maxpower.ca/about-maxpower/terms-of-use-legal-notice/';
//
}
// Hook Stupid Simple Notice into the footer
add_action(’wp_footer’, ‘SSILN_footer’);
?>
[/php]
Download legalfooter.phps
To use this simple script in your own blog, simply download the file, edit the $mylegalnotice variable to point to the right WordPress page (making sure to keep the appropriate formating) and save it as SSLegalInsert.php (or any anything*.php your want). Upload it to your plugins directory and activate it under the plugins admin menu in WordPress.
Simple right? Anyone have any improvements or ideas? Alternatives?
26 Oct 06
5:24 am
Writing a plugin appears fairly straight forward. But what about creating one that can be customised from within the control panel??
26 Oct 06
7:28 am
There are plenty that do that, but this is stupid simple. What did you have in mind?
26 Oct 06
7:36 am
A possibilty wher you can create the page from within the control panal rather then using a page to do it. its jus a thought more then anything else.
26 Oct 06
7:44 am
To be cheeky: you have to use the control pannel to create the page ;). All this plugin does is insert the link in the bottom of the page. But I do know what you are getting at.