daily pastebin goal
54%
SHARE
TWEET

Untitled

a guest Dec 15th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3.  * Add a help tab to the new/edit post screen.
  4.  * Action: admin_head-post.php, admin_head-post-new.php
  5.  */
  6. function cmfy_add_gumbo_help_tab() {
  7.     // Get the WP_Screen object
  8.     $screen = get_current_screen();
  9.  
  10.     // Adjust / remove this conditional depending on which hook you're firing on
  11.     if ( 'comm_cpt_gumbo_ingr' == $screen->post_type ) {
  12.         $screen->add_help_tab( array(
  13.             'id'        => 'gumbo-info',
  14.             'title'     => __( 'Usage', 'cmfy' ),
  15.             'content'   =>
  16.                 '<p>' . esc_html__( 'This post type will create a gumbo ingredient entry which is a small thumbnail with some hover information.', 'cmfy' ) . '</p>' .
  17.                 '<ul>' .
  18.                     '<li>' . __( '<strong>Title</strong> will show up when an icon is hovered over.', 'cmfy' ) . '</li>' .
  19.                     '<li>' . __( '<strong>Excerpt</strong> is currently not used on the front-end but is kept in place for a future addition.', 'cmfy' ) . '</li>' .
  20.                 '</ul>'
  21.             ) );
  22.  
  23.         $screen->set_help_sidebar( __( '<p><strong>For more information:</strong></p><p><a href="/gumbo">View Gumbo</a></p>', 'cmfy' ) );
  24.     }
  25. }
  26. /**
  27.  * Change actions depending on which screen you want the help tabs.
  28.  * In this case, I want this help tab to fire on new / update post type.
  29.  * I am restricing which post type with a conditional post type lookup inside of
  30.  * the callback. For example, if you wanted to add a help tab to the
  31.  * general options page, hook into 'admin_head-options-general.php'.
  32.  */
  33. add_action( 'admin_head-post.php', 'cmfy_add_gumbo_help_tab' );
  34. add_action( 'admin_head-post-new.php', 'cmfy_add_gumbo_help_tab' );
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top