Uyh

The script begins with six lines, including the basic information the WordPress Plugin Directory needs from each plug-in.

■ Plugin URI—The home page for this plug-in

■ Description—A brief explanation telling your would-be users what your plug-in does and why they need it

Figure 15.4

Edit plug-ins just like themes in the WordPress plug-in editor.

Figure 15.4

Edit plug-ins just like themes in the WordPress plug-in editor.

Even if you don't want to be included in the Plugin Directory, having this information in your plug-in is an excellent practice to follow.

The real program begins with a couple of IF statements that check for special conditions before the program should run. ABSPATH is a constant in WordPress invoked when WordPress is installed to a different directory than the blog URL. The program runs when it finds both the WordPress files, and the plug-in (Class followme) is activated. if (IdefinedCABSPATH1)) {

Although not required to be included in the Plugin Directory, it's very good to have explicit licensing information in this initial information section. The directory requires all plug-in code to be released under a free or open source license, compatible with the GNU General Public License—just as the WordPress code itself is.

The bulk of this script creates the followme class, with a series of functions that define the badge and set up the administrative settings that make the plug-in useful. The first function adds FollowMe to the Settings menu: Class followme {

function init() {

// attach the handler add_action('wp_head', array('followme', 'wp_head')); add_action('wp_footer', array('followme', 'wp_footer')); // attach to admin menu if (is_admin()) {

add_action('admin_menu', array('followme', _menu')

Was this article helpful?

0 0
Blogging 101

Blogging 101

Turn your posts into cash... If You’ve Been Struggling To Make Money With Your Blog You Must Read This!! If you are like me then you’ve been working non stop to find ways to promote your blog so that it will start earning money.

Get My Free Ebook


Post a comment