WordPress Plugin tutorial part 2 The Header

Ok so lets get started. create a file with your text editor. Add the following text to the very top of the file.

<?php
/*
Plugin Name: Author Plug
Plugin URI: http://MyBlogIt.net/plugins
Description: Displays a short bio and image for each author above or below each post.
Version: 0.5
Author: David Span
Author URI: http://davidspan.com/
*/
?>

Plugin Header

What we have just done is add our plugin’s header to the file. This information will be displayed within the plugin page of WordPress. Now save this file to your plugin directory with the name author_plug.php.

Congratulations, you have just created your first working plugin. If you go to your plugin page within your WordPress dashboard you can activate it.

Of course it does nothing at this point you can leave it active as you work on it. With what we are going to be doing it will not harm your WordPress installation.

Other Files

If your plugin requires other files you can include them in the plugin directory as well. Just do not include the header within them. You can also put your plugin in it’s own subdirectory as well. As long as your main plugin file has the plugin header WordPress will find it.

Final Note

Whenever your working with php it’s a good idea to have no white space before your open php tag. Doing so can cause php header errors.

2 Responses to “WordPress Plugin tutorial part 2 The Header”

  1. David,

    I love your series on WordPress-related do-it-yourself projects. Great stuff, especially your comments about PHP. Keep up the good work, and I’ll be coming back for more on a regular basis.

  2. Thank you WebGyver.

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>