View difference between Paste ID: JYXvxa3u and
SHOW: | | - or go back to the newest paste.
1-
1+
class BBE_plugin {
2
	public function __construct() {
3
		if ( ! is_admin() ) {
4
			add_action( 'wp_enqueue_scripts', array( &$this, 'bbe_scripts' ) );		
5
		}
6
		
7
		if ( is_admin() ) {
8
			add_action( 'wp_ajax_nopriv_bbe_box', array( &$this, 'bbe_box' ) );
9
			add_action( 'wp_ajax_bbe_box', array( &$this, 'bbe_box' ) );
10
		}		
11
	}
12
	// this function is run through AJAX
13
	public function bbe_box() {
14
		if ( is_single() && get_post_type() == 'boxy' ) { // this check fails...
15
			echo '500';
16
			exit; 
17
		} else {
18
			echo '200';
19
			exit;
20
		}
21
	}
22
} // end class
23
24
add_action( 'plugins_loaded', 'bbe_start' );
25
26
function bbe_start() {
27
	$bbe_core = new BBE_plugin();	
28
	return true;
29
}