Skip to content

Instantly share code, notes, and snippets.

@WagnerMatos
Created January 3, 2013 19:17
Show Gist options
  • Save WagnerMatos/4446166 to your computer and use it in GitHub Desktop.
Save WagnerMatos/4446166 to your computer and use it in GitHub Desktop.
// Wrap all categories in a function
function wcat2() {
$out = array();
$categories = get_categories();
foreach( $categories as $category ) {
$out[$category->term_id] = array(
'label' => $category->slug,
'value' => $category->term_id
);
}
return $out;
}
With the code below we'll create the custom meta box:
// Add the Meta Box
function home_custom_meta_box() {
add_meta_box(
'home_meta_box', // $id
'Custom Meta Box', // $title
'home_show_custom_meta_box', // $callback
'page', // $page
'normal', // $context
'high'); // $priority
}
add_action('add_meta_boxes', 'home_custom_meta_box');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment