1

I'm working on a custom post type. I have the editor enabled but the content that will go in that box is secondary and it isn't clear what should be typed there so I want to add a label for the editor. How do I do that?

2 Answers 2

2

I recently used this in one of the projects, so here you go

add_action( 'edit_form_after_title', 'wp692_edit_form_after_title' );

function wp692_edit_form_after_title() {
echo '<h2>This is My Label!</h2>';
}
1
  • This is a really good option normally. I assume it won't work for me, though, because I already have a function that moves the editor below some other custom fields... ;) Commented May 15, 2015 at 20:36
1

After hacking around, this is the solution I came up with:

At the top of functions.php I have the following line:

add_action('admin_footer', 'add_title_to_editor');

Just thrown in the middle of functions.php I have the following function:

function add_title_to_editor() {
    global $post;
    if (get_post_type($post) == 'my_custom_post_type') : ?>
        <script> jQuery('<h3>Optional Additional Information</h3>').insertBefore('#postdivrich'); </script>
    <? endif;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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