Meta boxes not showing up
Never mind I just went full potato and forgot to include the file into my functions.php Is there any way to delete this question?
Never mind I just went full potato and forgot to include the file into my functions.php Is there any way to delete this question?
To add a meta box to multiple post types, one add_meta_box per post type is needed. In this example, instead of duplicating the same code, a foreach is used. More post types can be added to the array and the meta box will be added in all of them: add_action( ‘add_meta_boxes’, ‘add_custom_box_wpse_94701’ ); function add_custom_box_wpse_94701() … Read more
Select Options Meta Data is Not Updating in Edit Meta Box
global $post; $header_meta = get_post_meta($post->ID, ‘page-header-meta’, true); if( isset( $header_meta ) ) { echo ‘<h1>’ . $header_meta . ‘</h1>’; } else { echo ‘<h1>Knowledgebase</h1>’; } What this portion of code does is it checks the ‘page-header-meta’ value according to the page being displayed. IF your parent page has the metavalue set then the header will … Read more
Reload meta box content with AJAX
You are referring to the metaboxes on the admin post screen right? For that you don’t need a plugin, just drop the following into your functions.php file. // add_action(‘user_register’, ‘set_user_metaboxes’); add_action(‘admin_init’, ‘set_user_metaboxes’); function set_user_metaboxes($user_id=NULL) { // These are the metakeys we will need to update $meta_key[‘order’] = ‘meta-box-order_post’; $meta_key[‘hidden’] = ‘metaboxhidden_post’; // So this can … Read more
Customer portal (posts as checklist)
Looks like you will have to use $meta = get_post_meta($post->ID, ‘_selected_post’, true); echo $meta; The registered post type is hidden using the _ and it’s name is defined at the line : $this->meta_key = “_selected_{$this->SELECT_POST_TYPE}”; Where SELECT_POST_TYPE is defined as ‘post’ at the line : var $SELECT_POST_TYPE = ‘post’; Hope it helps.
Variables do not expand inside single quotes, so this– selected( $selected, ‘$post_type->name’— is literally checking for a string that looks like ‘$post_type->name’. If you are saving the option names, it should work if you just remove the quotes (though I did not run your code to test that). Your might be able to exclude what … Read more
Let’s say your post type is named product. You register your metabox with … add_action( ‘add_meta_boxes_product’, ‘register_product_metabox’ ); function register_product_metabox() { // register the metabox } You get the post id in your callback per post object now: function metabox_callback( $post ) { $field = get_post_meta( $post->ID ); } This happens because WordPress calls the … Read more