2

I want to show some short description in the All post_type view of a custom post type in the WordPress Admin Dashboard.

For example:

For this custom post type, my shortcode is this [shortcode].

Is there any way to show this before all posts?

  • Your question isn't clear. The title says "how can I show shortcode description" but in your description, it says "I want to show some short description". Which one is correct? Wanna show a short description or shortcode description? – obiPlabon Jul 18 '18 at 9:52
  • want to show some short description, i couldn't make up the title, please omit it – Nayeem Hyder Riddhi Jul 18 '18 at 9:55
  • the problem is simple, but i couldn't get the proper solution – Nayeem Hyder Riddhi Jul 18 '18 at 9:56
  • 1
    Post edited based on the comments and accepted answer. – Fayaz Jul 18 '18 at 10:55
2

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 check here:

function post_type_desc( $views ){    
    printf('<h4>%s</h4>', __('Your description here.') ); // echo 
    return $views; // return original input unchanged
}
add_filter("views_edit-POST_TYPE_HERE", 'post_type_desc');

Replace your_post_type here in POST_TYPE_HERE.

Hope this will help you.

  • where i will put post type, $post_type = get_post_type_object($screen->post_type); – Nayeem Hyder Riddhi Jul 18 '18 at 10:29
  • You can replace your post_type_name in "POST_TYPE_HERE" it in the add_filter () – Baikare Sandeep Jul 18 '18 at 10:32
  • @NayeemHyderRiddhi, I have updated code what you want. – Baikare Sandeep Jul 18 '18 at 10:41
  • Glad to know that, cheers! – Baikare Sandeep Jul 18 '18 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.