Go figure, I try for 4 hours, then solve the problem 5 minutes after I post on the forum.
The issue seems to be that you cannot call add_menu_page or any of those functions from outside the class. You need to call add_action(‘admin_menu’,array(class,function_to_setup_menu));
Then in function_to_setup_menu, use add_menu_page().
Here is a code sample:
<?php
//Set Up Class
if (!class_exists("B2BannerRotator")) {
class B2BannerRotator {
function B2BannerRotator() { //constructor
}
function Main() {
return 0;
}
function ConfigureMenu() {
add_menu_page("Test", "tesT", 6, 'b2_bannerrotator', array('B2BannerRotator','Main'));
}
}
}
//Create new instance of class
if (class_exists("B2BannerRotator")) {
$b2_banner_rotator = new B2BannerRotator();
}
//Actions and Filters
if(isset($b2_banner_rotator)){
// Administration Actions
add_action('admin_menu', array($b2_banner_rotator,'ConfigureMenu'));
}
?>