Add meta box to custom post
-
Hi I have a meta box I’m trying to enable in custom post types but I can’t see what’s wrong with the following code. Can anyone help?
Thanks
function meta_box() { if ( function_exists( 'get_post_types' ) ) { $post_types = get_post_types( array(), 'objects' ); foreach ( $post_types as $post_type ) { if ( $post_type->show_ui ) { add_meta_box( 'Publish to twitter', 'twitter', array( 'add_twitter_metabox', 'noindex_option_fill' ), $post_type->name, 'side' ); add_meta_box( 'Add to the slider', 'slider', array( 'add_slider_metabox', 'noindex_option_fill' ), $post_type->name, 'side' ); } } } else { add_meta_box( 'twitterbox', __('Publish to twitter', 'twitter'), 'add_twitter_metabox', 'post', 'normal', 'high'); add_meta_box( 'sliderbox', __('Add to the slider', 'slider'), 'add_slider_metabox', 'post', 'normal', 'high'); } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Add meta box to custom post’ is closed to new replies.