Using the Description
-
As noted at
https://docs.pluginize.com/article/displaying-post-type-descriptions/
you can display those handy descriptions that you create, to enhance the workflow in the WP backend. Below is how we have implemented it, to add some additional notes for some other standard post types as well. This code would live in your theme’s functions.php or a plugin’s functions.php`
function bkj_mf_general_admin_notice(){
global $pagenow;
// see https://developer.www.ads-software.com/reference/functions/get_current_screen/
$current_screen = get_current_screen();
$postinfo = get_post_type_object($current_screen->post_type);
$message = ”;switch ($current_screen->post_type) {
case ‘post’ :
$message = “Posts are content such as news, press releases, etc.”;
break;
case ‘elementor_library’ :
$message = ‘Elementor Templates are special layouts you can use in three different ways:<br>
A: Insert as a Widget when editing in Elementor<br>
B: Insert as a shortcode using [elementor-template id=”xxxxx”]<br>
C: Use as a starting point when creating a new Elementor page.’;
break;
case ‘page’ :
$message = ‘Pages are for long-term, “evergreen” content that is not likely to change.’;
break;
default:
if ($postinfo->description) {
$message = $postinfo->description;
}
}if ( ( $pagenow == ‘edit.php’) && $message) {
echo ‘<div class=”notice notice-info”><p>’;
//print_r($postinfo);
echo $message;
echo ‘</p>
</div>’;
}
}
add_action(‘admin_notices’, ‘bkj_mf_general_admin_notice’);
- The topic ‘Using the Description’ is closed to new replies.