Showing a meta box in a custom post type on a page

If you are not using multiple key & values, I’d try it this way // This function adds a meta box with a callback function of my_metabox_callback() function add_my_meta_box() { $var1 = ‘this’; $var2 = ‘that’; add_meta_box( ‘metabox_id’, ‘Metabox Title’, ‘my_metabox_callback’, ‘page’, ‘normal’, ‘low’, array( ‘foo’ => $var1, ‘bar’ => $var2) ); } // $post … Read more

How can I modify a custom post type and custom page template for a child theme if all content seams to be handled by theme’s ‘native’ plugin?

It seems to me like this is just a regular addition to functions. Since you are asking, I think you may not be getting the result you are looking for. If this was my project, I would create a new plugin, install it into the regular plugin list so that it does not get overwritten … Read more

Meta Box multi checkbox in template

This will be made in the side of the template. First get all the sizes into an array: $allSizes = array( ‘XS’ => ‘Extra Small’, ‘S’ => ‘Small’, ‘M’ => ‘Medium’, ‘L’ => ‘Large’, ‘XL’ => ‘Extra Large’, ‘XXL’ => ‘Extra Extra Large’, ); echo ‘<ul>’; $outStock = get_post_meta($post->ID, ‘Sizes_available’, true); Then let’s compare if … Read more

Undefined index: post in NOTICE while adding meta box

You get that error, because the $_GET and $_POST are not filled on every admin page with that data. Also, your code should never rely on globals, they can be changed by any other code, so they are not reliable. So don’t use global $post;, $_POST or $_GET when you can get the information from … Read more

wp_editor for custom post type doesn’t save value

You forgot to declare the variable $main_detail. Since it’s a meta field you need to retrieve it first before you add it. $main_detail = get_post_meta($post->ID, ‘_main_detail’, true); Also, I can see that some errors in your code. echo ‘<label >’;?><?php _e( ‘short description:’ );?></label> Should be.. echo ‘<label >’ . _e( “short description:” ) . … Read more

Metabox not being added

That code doesn’t call the metaboxes of the good screen. Try this to call the metaboxes of the current screen. do_meta_boxes(”, ‘normal’, ‘saed’);

adding ajax load more to display images from meta box

It can be done just following regular way to use Ajax in WordPress. https://codex.wordpress.org/AJAX_in_Plugins First register a script file and also create an AJAX Call. wp_enqueue_script( ‘meta-ajaxscript’, get_stylesheet_directory_uri() . ‘/js/ajax-init.js’, array( ‘jquery’ ), ”, true ); wp_localize_script( ‘meta-ajaxscript’, ‘ajaxMeta’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ) )); Second, Wrap your metadata with a parent element by … Read more