Skip to content

Instantly share code, notes, and snippets.

@Pross
Created February 11, 2012 17:12
Show Gist options
  • Save Pross/1802536 to your computer and use it in GitHub Desktop.
Save Pross/1802536 to your computer and use it in GitHub Desktop.
Simple class plugin
<?php
/*
Plugin Name: Demo
Plugin URI: http://www.xxxx
Author: Name...
Author URI: http://www.xxxx
Demo: http://www.xxxxx
External: http://www.xxxxx
Description: A simple demo
PageLines: true
Version: 1.0
*/
class DemoClassName {
/**
* Construct, always run when class is initiated
*
*/
function __construct() {
$this->init();
if ( !is_admin() )
add_action( 'wp_footer', array( &$this, 'test_function' ) );
}
function test_function() {
echo sprintf( '<p>Hello %s</p>', $this->val );
}
function init() {
// this is being called from the contructor, so its gonna be run everywhere!
$this->val = 'World!';
}
} // class end
// this starts the plugin code.
new DemoClassName;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment