Adding admin menus to wordpress

add_action(‘add_meta_boxes’, ‘add_testbox’); function add_testbox() { add_meta_box( ‘testmetabox’, ‘Test Meta Box’, ‘testmetabox_content’, ‘post’, ‘side’, ‘low’); } function testmetabox_content() { echo “hi”; } You can drag and drop the box into the spot you want it to display. Make sure you always wrap the add_meta_box() function in another function, then hook that in like I showed. If … Read more

Output from Meta Box Array

Add meta data as “flat” data to the post The actual problem is, that your meta data comes back as array (with a single entry), when calling get_post_custom( $id ); for your post. Here’s a simple function, that adds all meta data attached to a post to your post object. /** * Merges custom/meta data … Read more

Add a meta box to ALL Pages

Try this. This is part of some code I use. // Add meta boxes to Page add_meta_box( ‘RelatedImage’, __(‘Related images’), ‘related_images_meta_box’, ‘page’, ‘normal’, ‘high’ ); function related_images_meta_box($object) { $nonce = wp_create_nonce(plugin_basename( __FILE__ )); ?> <input type=”hidden” name=”wp_filebrowser_nonce” id=”wp_filebrowser_nonce” value=”<?php echo $nonce; ?>” /> <table> <tr> <td> <label for=”related_image” class=””>Related image</label> </td> <td> <input type=”text” id=”related_image” … Read more

Separate tags with semicolon

The tag delimiter is made translatable: $comma = _x( ‘,’, ‘tag delimiter’ ); So this can be changed with a simple filter: add_filter( ‘gettext_with_context’, ‘t5_semicolon_tag_delimiter’, 10, 4 ); function t5_semicolon_tag_delimiter( $translated, $text, $context, $domain ) { if ( ‘default’ !== $domain or ‘tag delimiter’ !== $context or ‘,’ !== $text ) return $translated; return ‘;’; … Read more

Saving zero in meta box

Your issue seems to be with too loose logic check, rather than saving. To treat valid but falsy value correctly you need something like this: if ( false !== $meta_value ) This will strictly match only the case when value doesn’t contain false (return of the API when fetch failed).