super-cpt icon indicating copy to clipboard operation
super-cpt copied to clipboard

Add method to add extra content (instructions) in meta boxes

Open theoephraim opened this issue 11 years ago • 1 comments

I find myself wanting to add short notes and instructions in meta boxes sometimes.

This could be added either as a single note at the top of the box (or one at the top and one at bottom), or by adding content to the fields array -- either as a new field type or as an option for each field.

For example - this shows 2 possible options:

$my_custom_type->add_meta_box( array(
    'id' => 'type_social',
    'title' => 'Social Profiles',
    'instructions_pre' => 'At least one profile is required for this widget to appear in search results.', 
    'fields' => array (
        '_twitter_username' => array( 'label'=>'Twitter Username', 'type'=>'text', 'instruction'=>'Do not include the @' ),
        ...
    )
));

This could be HTML content, which would let you be messy if you wanted to be, but would also be the most flexible.

theoephraim avatar Jul 31 '13 21:07 theoephraim

implemented something simple -- https://github.com/mboynes/super-cpt/pull/18

theoephraim avatar Jul 31 '13 22:07 theoephraim