/** * Initialize plugin * @return void */ static function init() { global $pagenow; self::$help_docs_dir[] = get_template_directory() . '/includes/help-docs'; self::$help_docs_img_url[] = get_template_directory_uri() . '/includes/help-docs/img'; self::$help_docs_dir = apply_filters('wp_contextual_help_docs_dir', self::$help_docs_dir); self::$help_docs_img_url = apply_filters('wp_contextual_help_docs_url', self::$help_docs_img_url); foreach (self::$tabs as $tab) { foreach ((array) $tab['page'] as $page) { self::$tabs_by_page[$page][] = $tab; if (count(self::$tabs_by_page[$page]) < 2) { add_action('load-' . $page, array(__CLASS__, 'add_tab_to_screen')); } } } }
/** * Contextual Help, docs in /help-docs folter * Documentation https://github.com/voceconnect/wp-contextual-help * * @since 1.0.0 */ public function contextual_help() { if (!class_exists('WP_Contextual_Help')) { return; } // Only display on the pages - post.php and post-new.php, but only on the `demo` post_type WP_Contextual_Help::register_tab('demo-example', __('Demo Management', $this->plugin_slug), array('page' => array('post.php', 'post-new.php'), 'post_type' => 'demo', 'wpautop' => true)); // Add to a custom plugin settings page WP_Contextual_Help::register_tab('pn_settings', __('Boilerplate Settings', $this->plugin_slug), array('page' => 'settings_page_' . $this->plugin_slug, 'wpautop' => true)); }