Let's start with learning a new way to code your plugins. We will use a PHP class, and add properties (variables) and methods (functions) to it.
Let's start building our plugin by creating our first class:
Create a new folder called
snazzy-archives
.Create a new file,
snazzy-archives.php:
<?php /* Plugin Name: Snazzy Archives Version: 0.1 Plugin URI: http://www.prelovac.com/vladimir/wordpress-plugins/ snazzy-archives Author: Vladimir Prelovac Author URI: http://www.prelovac.com/vladimir Description: Express your blog through a unique representation of your post archives. */ global $wp_version; $exit_msg = 'Snazzy Archives require WordPress 2.6 or newer. <a href="http://codex.wordpress.org/ Upgrading_WordPress">Please update!</a>'; if (version_compare($wp_version, "2.6", "<")) { exit($exit_msg);
Then add declaration for our class as follows:
// Avoid name collisions. if ( !class_exists('SnazzyArchives...