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')

Newbies Guide To Online Hobby Profits

Newbies Guide To Online Hobby Profits

Many people are passionate about their hobbies. They make time in their lives for them, spend lot of money on them, and even sometimes move their homes, families and jobs just to be closer to their hobbies. But even if you just enjoy your hobby and perhaps wouldn't class yourself as a fanatic, wouldn't it be great if you could earn money online possibly even a full-time income, from simply telling others people about your passion?

Get My Free Ebook

Post a comment