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(){ ?>

Add Widget After Content Options

Now you can add AWAC after comments. View Addons
plugin_name), array($this, 'awac_exclude_options_display'), 'awac-options', array('class'=>'subtitle') ); add_settings_field( 'all_post_types', __('Post Types

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 Formats

The 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 '
' ; } } /** * Display the checkboxes for each post format * */ public function awac_formats_boxes_display(){ if ( current_theme_supports( 'post-formats' ) ) { $post_formats = get_theme_support( 'post-formats' ); if ( is_array( $post_formats[0] ) ) { foreach ($post_formats[0] as $post_format) { $formats[$post_format] = $post_format; } } }else{ echo 'Theme does not support post formats'; return; } $options = (array)get_option('all_post_formats'); foreach ( $formats as $format ) { if( !isset($options[$format]) ) { $options[$format] = 0; } echo '
' ; } } /** * Display rate us message in footer only on settings page. * @param string $text wordpress admin footer text * @return string updated footer text */ function awac_display_admin_footer($text) { $currentScreen = get_current_screen(); if ( $currentScreen->id == 'appearance_page_awac-options' ) { $rate_text = sprintf( __( 'Thank you for using Add Widget After Content! Please rate us on WordPress.org', $this->plugin_name ), 'https://pintopsolutions.com/downloads/add-widget-after-content/', 'https://wordpress.org/support/view/plugin-reviews/add-widget-after-content?filter=5#postform' ); return str_replace( '', '', $text ) . ' | ' . $rate_text . ''; } else { return $text; } } } /*End class AddWidgetAfterContentAdmin*/ }