Add template meta box to category edit page?

I’m currently working on a theme framework and one of it’s classes is a custom category template class which does just what you are asking for: it adds a select field to the category edit screen that lets you select a template, just like with pages, and i just published it as a plugin Custom … Read more

Add character count to custom metabox

I assume the #feed element is the one in which you want the count value to appear? If so, change the #bgnp_metabox_tabs entry in your keyup function to #feed. EDIT: For some reason, I wasn’t seeing all the code when I first read the problem. The id of your placeholder for the character count is … Read more

Replace the Post Excerpt Meta Box with a Field in My Custom Meta Box

Just name the field ‘excerpt’. E.g.: <textarea name=”excerpt” id=”excerpt”><?php echo esc_html( ‘$post->post_excerpt’ ); ?></textarea> <!– if it is a textarea field –> or <input name=”excerpt” id=”excerpt” value=”<?php echo esc_attr( ‘$post->post_excerpt’ ); ?>” /> <!– if it is a text field –>

prevent post submission

See the Codex, on save_post. In answer to Question 1, it is fired whenever WordPress auto_saves a revision (i.e. hence when a post is edited). In particular, when creating a new post, wp-admin/post-new.php is loaded. WordPress then creates an auto draft even if you haven’t saved a draft or published to post. This is intended … Read more

Save checkboxes of a metabox with a foreach loop (invalid argument)

My advise would be to extract the query portion of your code: function get_brands() { $loop_brands = array(); wp_nonce_field( plugin_basename( __FILE__ ), ‘brands-nonce-field’ ); $args = array( ‘post_type’ => ‘page’, ‘post_parent’ => 7, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’ ); $query_brands = new WP_Query($args); return $query_brands; } Then use it like this: function brands_save_meta_box( $post_id … Read more

Why is `add_meta_box` not working?

I can see 2 problems with your code. You seem to want that meta box to appear on product pages, but you actually add it to the post type and not the product post type. The other problem is the hook you attach your function to. Try this: add_action( ‘add_meta_boxes_{post_type}’, ‘abc_load_post’ ); Substitute {post_type} with … Read more

Conditional Meta Boxes

This can be easily solved with jQuery, and it has the advantage of real-time feedback. I’ve already covered this situation in a couple of questions, so instead of going through your code and writing the proper functions, I suggest you go through my code and adapt it to your needs. meta content on required pages … Read more