How to add new Metadata options (Date, Author, etc.) for Posts?
How to add new Metadata options (Date, Author, etc.) for Posts?
How to add new Metadata options (Date, Author, etc.) for Posts?
How to get meta box labels?
add_meta_box showing blank screen in my page
Meta box not displaying on the plugin page
Save Edit button then disabled readonly metabox
REST API custom endpoints for metaboxes
Warning: Illegal string offset ‘post’ and ‘page’
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
as example of js code that will run on every new post page function admin_footer_se_119285(){ ?> jQuery(window).ready(function(){ if (jQuery(‘#metabox-id-div’).length == 1){ // put your code } }) <?php } ?> Take a look to usefull reference to admin_footer-(plugin_page) action hook
Simlified function, maybe will help someone: jQuery(document).ready(function($) { $(“#page_template”).change(function() { if($(‘#page_template’).val() != ‘page-contacts.php’) { // show the meta box $(‘#postdivrich’).show(); } else { // hide your meta box $(‘#postdivrich’).hide(); } }).change(); }); Of course it lacks controls what fields will be submitted, because jQuery just hides them. As I am coding it for one-admin user … Read more