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
Creating And Writing Your Blog

Creating And Writing Your Blog

The success of a blog lies in the content. It is the content and the key words that consistently attract potential customers. Great blog content literally means something different on every blog. Great blog content is researched and not impulsive. You cannot treat the blog as an experimental playground and expect it to work for you. It is designed to mean business and make you presence felt online and you have to ensure it performs the way you want it to.

Get My Free Ebook


Post a comment