leesy
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: Accessing My Plugin From A ThemeNo, I can’t see any. I think I am just missing on final piece of code. My plugin looks a little like this:
<?php /** Usual comments here **/ if (!class_exists("ImageRotator")) { class ImageRotator { private $uploadPath = ''; private $pluginPath = ''; private $options; function __construct() { $this->uploadPath = dirname(__file__).'\\uploads\\'; // add_shortcode('imagerotator', array(&$this, 'generateHtml')); } // Various functions for plugin function generateHtml() { echo '<p>Hello World</p>'; } } } /** * Create instance of image rotator */ $imageRotator = new ImageRotator(); /** * Create actions & filters for WordPress */ if (isset($imageRotator)) { // Actions add_action('admin_menu', array(&$imageRotator, 'createMenu')); add_action('admin_init', array(&$imageRotator, 'registerSettings')); add_action('imagerotator_show', array(&$imageRotator, 'generateHtml')); }And in my header all I have added is:
<?php if (isset($imageRotator)) { $imageRotator->generateHtml(); } else if (isset($ImageRotator)) { print_r($ImageRotator); } else { echo '<p>Nope!</p>'; } if (function_exists("imagerotator_show")) { echo 'Function found'; } else { echo 'Function NOT found'; } ?>Which also displays “Nope” and “Function not found”.
So what am I missing? Do I need to include my plugin again somewhere as I was assuming WordPress would handle this for me.
Viewing 1 replies (of 1 total)