admin_url( 'admin-ajax.php' ), // generate a nonce with a unique ID "myajax-post-comment-nonce" // so that you can check it later when an AJAX request is sent 'amsaMobileNonce' => wp_create_nonce( 'amsa-mobile-nonce' ) ) ); } static function amsa_sample_metaboxes( $meta_boxes ) { $prefix = '_amsa_'; // Prefix for all fields $meta_boxes[] = array( 'id' => 'show_mobile_slidead', 'title' => 'Show in Mobile SlideAd?', 'pages' => array('post'), // post type 'context' => 'normal', 'priority' => 'low', 'show_names' => true, // Show field names on the left 'fields' => array( array( 'name' => __( 'Show?', 'cmb' ), 'desc' => __( 'Tick if you would like this to be included in the randomised selection for posts in the mobile slidead', 'cmb' ), 'id' => $prefix . 'show_mobile_slidead', 'type' => 'checkbox', ), ), ); return $meta_boxes; } /** * Take care of the settings that can be set */ public function register_admin_settings() { //register our settings register_setting( 'amsa-settings-group', 'amsa_posts_to_show' ); register_setting( 'amsa-settings-group', 'amsa_box_title' ); } /** * Take care of the settings link */ public function add_admin_settings() { // ... add_options_page( 'Mobile SlideAd Options', 'Mobile SlideAd', 'manage_options', 'amsa-settings-group', array( $this, 'amsa_admin_options' ) ); } /** * Take care of the settings link */ public function amsa_admin_options() { if ( !current_user_can( 'manage_options' ) ) { wp_die( __( 'You do not have sufficient permissions to access this page.' ) ); } echo '