Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Add a help tab to the new/edit post screen.
- * Action: admin_head-post.php, admin_head-post-new.php
- */
- function cmfy_add_gumbo_help_tab() {
- // Get the WP_Screen object
- $screen = get_current_screen();
- // Adjust / remove this conditional depending on which hook you're firing on
- if ( 'comm_cpt_gumbo_ingr' == $screen->post_type ) {
- $screen->add_help_tab( array(
- 'id' => 'gumbo-info',
- 'title' => __( 'Usage', 'cmfy' ),
- 'content' =>
- '<p>' . esc_html__( 'This post type will create a gumbo ingredient entry which is a small thumbnail with some hover information.', 'cmfy' ) . '</p>' .
- '<ul>' .
- '<li>' . __( '<strong>Title</strong> will show up when an icon is hovered over.', 'cmfy' ) . '</li>' .
- '<li>' . __( '<strong>Excerpt</strong> is currently not used on the front-end but is kept in place for a future addition.', 'cmfy' ) . '</li>' .
- '</ul>'
- ) );
- $screen->set_help_sidebar( __( '<p><strong>For more information:</strong></p><p><a href="/gumbo">View Gumbo</a></p>', 'cmfy' ) );
- }
- }
- /**
- * Change actions depending on which screen you want the help tabs.
- * In this case, I want this help tab to fire on new / update post type.
- * I am restricing which post type with a conditional post type lookup inside of
- * the callback. For example, if you wanted to add a help tab to the
- * general options page, hook into 'admin_head-options-general.php'.
- */
- add_action( 'admin_head-post.php', 'cmfy_add_gumbo_help_tab' );
- add_action( 'admin_head-post-new.php', 'cmfy_add_gumbo_help_tab' );
Add Comment
Please, Sign In to add comment