How can I put a checkbox in the post editor

Your code is correct and is ready for a number field. To make it work for a checkbox, you just need to change the type attribute of the input element from number to checkbox and manage the checkbox state. I think this should work: add_action( ‘add_meta_boxes_post’, “spiaggia_add_meta_box” ); function spiaggia_add_meta_box(){ add_meta_box( “spiaggia_meta_box”, __( “Checkbox Title”, … Read more

How to make remove display none to this div container in post meta box?

This did the trick, in jQuery: //get page title var edit_title_page=$(“html head title”).text(); //Confirm if this is right Edit page if (edit_title_page.indexOf(“Edit Form”) >= 0) { $(‘#postbox-container-2’).removeClass(“postbox-container”); $(‘#postbox-container-2’).css(‘width’,’100%’); $(‘#postbox-container-2’).css(‘float’,’left’); $(‘#mymetaboxID’).show(); } It will first check for edit page title, if it’s on the right page, remove the post-box container containing the display none, then apply … Read more

Metaboxes – why they don’t render php in expected manner?

The whole page/post/custom post type post screen is a big form. That means that whenever you hit “publish” on a post type edit screen, the whole form – and that means every content on the page – gets processed and WordPress executes everything. And that “everything” includes all kinds of hooks that you should use … Read more

Input select option Change Content in Metabox

This is totally wrong. Metaboxes are shown on post/page editing screen, so if you submit your own form, the whole page will be submitted/refreshed. Look up what a metabox is here => SO Thread You should use WP’s own functions to deal with this. Look add_meta_box() and check this tutorial to know how you should … Read more