When a CPT relies on a lot of custom fields via ACF, the unlabeled main editor can be confusing (“What’s this for?”). This code goes in the theme’s functions file, although I put it in my evo-post-types.php MU plugin so it’s together with the rest of my CPT-specific code.
The repeated open/close PHP tags are because the script text is tricky to echo with its single and double quotes.
<?php // ADD LABEL TO MAIN EDITOR ON SOME CPTs add_action('admin_footer', 'add_title_to_editor'); function add_title_to_editor() { global $post; if (get_post_type($post) == 'regevents') { ?> <script> jQuery('<h4 class="editorlabel">Event Description/Main Content</h4>').insertBefore('#postdivrich'); </script> <?php } if (get_post_type($post) == 'exhibitions') { ?> <script> jQuery('<h4 class="editorlabel">Exhibition Description/Main Content</h4>').insertBefore('#postdivrich'); </script> <?php } if (get_post_type($post) == 'bizspot') { ?> <script> jQuery('<h4 class="editorlabel">Business Description/Main Content</h4>').insertBefore('#postdivrich'); </script> <?php } } ?>
Also, you can style the label in admin-style.css:
.wp-admin h4.editorlabel { font-size:1.2em; margin:0; padding-top:1.5em; }
Enqueue the admin style sheet in the theme’s functions file:
//add admin stylesheet add_action( 'admin_enqueue_scripts', 'load_admin_style' ); function load_admin_style() { wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/admin-style.css', false, '1.0.0' ); }
Reference Links
https://wordpress.stackexchange.com/questions/188480/add-a-label-to-the-editor