Skip to content

Instantly share code, notes, and snippets.

@baikaresandip
Last active July 18, 2018 11:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baikaresandip/f2389741b19c75254a13bb945f8815cd to your computer and use it in GitHub Desktop.
Save baikaresandip/f2389741b19c75254a13bb945f8815cd to your computer and use it in GitHub Desktop.
Wordpress add short description on the custom post type page: The filter views_{$this->screen->id} is fired just after the title of post edit screen has been print to screen, so it's a safe place to just echo what you want. So you can simply do:
<?php
function post_type_desc( $views ){
$screen = get_current_screen();
$post_type = get_post_type_object($screen->post_type);
if ($post_type->description) {
printf('<h4>%s</h4>', esc_html($post_type->description)); // echo
}
return $views; // return original input unchanged
}
add_filter("views_edit-POST_TYPE_HERE", 'post_type_desc');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment