Skip to content

Instantly share code, notes, and snippets.

@kerelist
Created November 18, 2016 17:20
Show Gist options
  • Save kerelist/f8aff73c1da5ab9919447e44f990adfd to your computer and use it in GitHub Desktop.
Save kerelist/f8aff73c1da5ab9919447e44f990adfd to your computer and use it in GitHub Desktop.
Add a custom widget box on the sidebar of chosen page or post types to provide instructions to the content editor.
add_action( 'add_meta_boxes', 'add_side_instructions_box' );
function add_side_instructions_box() {
foreach( array( 'custom_post_type', 'page' ) as $customPages ) { //list which posts you would like this to appear on
add_meta_box(
'project_side_instructions', //meta box id
__( 'Helpful Hints', 'site_domain' ), //meta box title
'inner_side_instructions_box', //callback to function with box content
$customPages, //which pages the box appears on
'side', //area of page where the box appears
'low' //box priority on page
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment