Adding a custom field or metabox to the post-thumbnail widget?

Is it possible to add a custom field to an existing “widget” in the backend?

What I wanna do is provide a way to have a checkbox to apply a thumbnail that is double the size of the normal one on the frontend. So I’m thinking of simply adding a custom field as a checkbox that says “Double the size” and when checked I return a different output on the frontend.

That is not the problem, I know how to do so.

However I wonder if it possible to locate this checkbox in the post-thumbnail widget in the backend?

enter image description here

Normally when adding a custom field it appears underneath the excerpt or content area. Is it possible to locate this checkbox inside the post-thumbnail widget?

Thank you in advance

1 Answer
1

Just filter admin_post_thumbnail_html and append your checkbox HTML:

add_filter( 'admin_post_thumbnail_html', 'wpse_71501_thumbnail_options' );
function wpse_71501_thumbnail_options( $html )
{ 
    return $html . <<<html
<p>
    <label for="big_thumbnail">
        <input id="big_thumbnail" name="big_thumbnail" type="checkbox" />
        Use big thumbnail
    </label>
</p>
html;
}

Leave a Comment