plugin_name = $plugin_name; $this->version = $version; add_action('admin_menu', array( $this,'awac_add_options_page')); add_action('admin_init', array( $this,'awac_initialize_options')); add_filter('admin_footer_text', array( $this,'awac_display_admin_footer')); } /** * Adds the 'Add Widget After Content Options' to the Appearance menu in the Dashboard */ public function awac_add_options_page(){ add_theme_page( 'Add Widget After Content Options', 'Widget After Content', 'manage_options', 'awac-options', array($this, 'awac_options_display') ); } /** * Fired when the plugin is uninstalled * */ public static function uninstall() { delete_option( 'all_post_types' ); delete_option( 'all_post_formats' ); } /** * Renders the content of the awac options page */ public function awac_options_display(){ ?>
The widget will not show on post types that are checked
', $this->plugin_name ), array($this, 'awac_type_boxes_display'), 'awac-options', 'exclude_section' ); register_setting( 'exclude_section', 'all_post_types' ); add_settings_field( 'all_post_formats', __('Post FormatsThe widget will not show on post formats that are checked
', $this->plugin_name ), array($this, 'awac_formats_boxes_display'), 'awac-options', 'exclude_section' ); register_setting( 'exclude_section', 'all_post_formats' ); } /** * Description for the exclude_section * */ public function awac_exclude_options_display(){ echo __('By default the widget will display on all posts. Use the options below to prevent the widget from showing on a specific post type or post format.
', $this->plugin_name ); } /** * Display the checkboxes for each post type * */ public function awac_type_boxes_display(){ $post_types = get_post_types(); $options = (array)get_option('all_post_types'); foreach ( $post_types as $type ) { if( !isset($options[$type]) ){ $options[$type] = 0; } echo '