Add Help to Wordpress Admin Menu

Posted on 26 October 2006

When I create sites for clients, I like to give them as much information as I can. I create video tutorials for them that show how to use their new site. I've gone about supplying these tutorials and general information they should have in various ways. What I have ultimately decided to do now is to simply create a link to a help page within the site itself that contains everything they need. This keeps it all centrally located and makes it available to whomever they would like to manage their site.

To accomplish this in Wordpress I have created a tiny custom plugin. All it does is add a Help link to the admin menu that goes to a backend page with all of their stuff. Since it is a plugin, I can reuse it over and over and just customize the text needed for each site. I could theoretically use a regular page on the site for all of this but I like keeping it in the admin section and I have easy control over who gets access to it by user level. I set it to a default of user level 5 for access since this is the level where folks can create new posts and pages and will be in need of the tutorials.

Now I am not a plugin writer. I have only dipped a toe in once or twice and prefer to use already established plugins for my needs. This is a really, really simple plugin to "write" so even if you aren't very comfortable with PHP or know nothing of Wordpress plugins, this is really easy to use and figure out what to edit. The code is taken verbatim from the Wordpress codex on Menus.

Here is the skeleton of what I use:

<?php/*Plugin Name: Help MenuDescription: Adds a site help link to the admin menuAuthor: Addison Berry*/// mt_add_pages() is the sink function for the 'admin_menu' hookfunction mt_add_pages() {// Add a new top-level menu: // The first parameter is the Page name(Site Help), second is the Menu name(Help) //and the number(5) is the user level that gets accessadd_menu_page('Site Help', 'Help', 5, __FILE__, 'mt_toplevel_page');}// mt_toplevel_page() displays the page content for the custom Test Toplevel menufunction mt_toplevel_page() { echo ' <div class="wrap"> <h2>Site Help</h2> <p>This page contains information and tutorials that are specific to your site. If you have trouble with anything on this page contact Addison Berry of <a href="<a href="http://rocktreesky.com">rocktreesky</a>" rel="nofollow">http://rocktreesky.com">rocktreesky</a></a> by sending an email using the <a href="<a href="http://rocktreesky.com/contact">" rel="nofollow">http://rocktreesky.com/contact"></a> rocktreesky contact form</a>.</p> <h3>Quick Questions</h3> <h4>I don\'t want people to see the edit link/be able to edit my site!</h4> <p>Those edit links only appear to you when you log in to the site as the admin. The public will NEVER see them and even other users with accounts won\'t see them unless you give them the rights to be able to edit something. To get rid of the links when you visit the site you must Sign Out of the admin account. You can do this from the administration pages in the upper right-hand corner.</p> <h3>Video Tutorials</h3> <p>Please note that these tutorials require a Flash Player, available to <a href="<a href="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">" rel="nofollow">http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=Shockw...</a> download for free from Adobe</a>.</p> <ul> <li><a href="/wp-content/uploads/filename.swf">How to edit existing pages</a></li> <li><a href="/wp-content/uploads/filename.swf">How to create a new page or post</a></li> </ul> </div> ';}// Insert the mt_add_pages() sink into the plugin hook list for 'admin_menu'add_action('admin_menu', 'mt_add_pages');?>

So, obviously you would change out the stuff that is specific to my site, mainly the html content between the echo ' and '; lines, and then just save it with a name that won't conflict with other plugins you use (e.g. siteHelp.php). Load it up like any other Wordpress plugin, activate it and you should see a Help link at the end of the admin menu. Easy-peasy.

I haven't built a Wordpress site in well over a year so the last version I used was 2.1 and I'm not sure that I used this snippet with that site. This was written when using the 2.0 series of Wordpress.

If anyone tests it out and could report back one way or the other that would be great.

I'm getting an error running this on 2.5.1 though when I try to log out after activating this.

Warning: Cannot modify header information - headers already sent by (output started at /home/flyingfox/go4/www/testpad/html/wp-content/plugins/test.php:1) in /home/flyingfox/go4/www/testpad/html/wp-login.php on line 202... [continues]