WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Move and rename "Featured Image" box (4 posts)

  1. mirko.menegazzo
    Member
    Posted 3 years ago #

    I would like to call the "Featured Image" box with another name ('Video Thumbnail') and move it from 'side' to 'normal'.

    It is a piece of cake if I replace this line in edit-form-advanced.php

    add_meta_box('postimagediv', __('Featured Image'),'post_thumbnail_meta_box', $post_type, 'side', 'low');

    with

    add_meta_box('postimagediv', __('Video Thumbnail'), 'post_thumbnail_meta_box', $post_type, 'normal', 'low');

    I do not want to touch the core files though, I want do do it via the functions.php in my child theme. I am also using it only for my custom post types.

    Any suggestion???

  2. mirko.menegazzo
    Member
    Posted 3 years ago #

    I figured it out!

    My post type is called 'au-portfolio', then I used this in my function.php:

    function customposttype_image_box() {
    
    	remove_meta_box('postimagediv', 'au-portfolio', 'side');
    
    	add_meta_box('postimagediv', __('Video Thumbnail - 100 X 60 pixels - Bigger images will be cropped automatically.'), 'post_thumbnail_meta_box', 'au-portfolio', 'normal', 'low');
    
    }

    Presto!

  3. watermelonkid
    Member
    Posted 2 years ago #

    Hey Mirko,

    Tried using this--where/how are you calling the customposttype_image_box() function. When I try to call it, my page admin section breaks. Am I missing something?

    -Brent

  4. mirko.menegazzo
    Member
    Posted 2 years ago #

    This is the full code, in my functions.php

    //Use "Featured Image" box as a custom box
    function customposttype_image_box() {
    
    	remove_meta_box('postimagediv', 'au-portfolio', 'side');
    	remove_meta_box('postimagediv', 'au-gallery', 'side');
    
    	add_meta_box('galleryimagediv', __('Full Size Image. Ratio 4:3, minimum size 800 x 600 pixels.'), 'post_thumbnail_meta_box', 'au-gallery', 'normal', 'low');
    	add_meta_box('postimagediv', __('Video Thumbnail - 100 X 60 pixels - Bigger images will be cropped automatically.'), 'post_thumbnail_meta_box', 'au-portfolio', 'normal', 'low');
    
    }
    add_action('do_meta_boxes', 'customposttype_image_box');

Topic Closed

This topic has been closed to new replies.

About this Topic