class BBE_plugin {
public function __construct() {
if ( ! is_admin() ) {
add_action( 'wp_enqueue_scripts', array( &$this, 'bbe_scripts' ) );
}
if ( is_admin() ) {
add_action( 'wp_ajax_nopriv_bbe_box', array( &$this, 'bbe_box' ) );
add_action( 'wp_ajax_bbe_box', array( &$this, 'bbe_box' ) );
}
}
// this function is run through AJAX
public function bbe_box() {
if ( is_single() && get_post_type() == 'boxy' ) { // this check fails...
echo '500';
exit;
} else {
echo '200';
exit;
}
}
} // end class
add_action( 'plugins_loaded', 'bbe_start' );
function bbe_start() {
$bbe_core = new BBE_plugin();
return true;
}