Articles of metabox

MetaBox with Editor instead of textarea – html not saved

I am calling several custom MetaBoxes in my custom post type on WordPress 4 like this without using a plugin: array( ‘label’ => __(‘MyContent’, myPlugin), ‘id’ => $prefix.’mycontent’, ‘type’ => ‘editor’ ), I can see the wysiwyg editor inside the post and I can also put some text inside which also saves correctly. But when […]

How can i get multi checkboxes value in metbox?

I make list of check boxes by WordPress meta-box and i can not get this value in my theme. i can get my text value with this code <? echo get_post_meta($post->ID, $prefix . ‘text’, true); ?> But if i use this code in check box it give me “Array” This is my Full code <?php […]

Is it possible to dynamically register menus?

I have a template, lets call it menu.php, which contains a menu. I would like the user to set the menu on this page by using WordPress’s own menus, so I don’t have to create something custom for it. They can in theory have multiple menu.php pages. The page template has a custom meta box […]

Meta box data not saving

I have just started working with custom post types and meta fields/data. I’m able to get the custom post and meta field to appear. It just won’t save. I’ve been staring at the code and reading up endlessly but nothing has jogged for me what is wrong. I would love some fresh eyes on it […]

Let author add field to metabox by pressing a button

I have added a custom metabox for authors where they can fill in a url to a source, which I can then use in my template. In my functions.php <?php /* Add metaboxes (see below) */ function add_custom_metaboxes(){ add_meta_box(‘source_post_metabox’, ‘Link to bron (optional)’, ‘output_source_metabox’, ‘post’); } add_action(‘add_meta_boxes’, ‘add_custom_metaboxes’); /* Save values of custom metaboxes on […]

Save Metabox Custom Field Value

I am using this code to show post type dropdown to select available post types but when i submit the post it restores the value back to post, how can i make sure it saves it? <select name=’my_meta_box_post_type’ id=’my_meta_box_post_type’> <?php $post_types=get_post_types(”, ‘objects’); foreach ($post_types as $post_type): ?> <option value=”<?php echo esc_attr($post_type->name); ?>”><?php echo esc_html($post_type->name); ?></option> […]

Should meta boxes for specific pages be save in their own plugins?

I realize this is a subjective question, but I need some opinions on where to put functionality like meta boxes that belong to specific pages. Let’s say I have a template called Gallery Page. On that gallery page I have some custom meta boxes that I use for some gallery related, custom input from the […]

add_meta_box creating default form field types

I’m using add_meta_box as per the Codex entry. My question is about the ‘callback’ to print the form fields on the admin page. In the Codex, the form fields are echoed as written out HTML elements, but in some plugins I’ve looked through, the developers prefer to use ‘callback_args’ to pass an easy to understand […]

How to add a text widget on the posts admin page?

I need to add a text widget on the posts admin page ie, the post editor page. so that I can add some code in the text widget for some purposes. Right now I have used text widget and this can only be used in sidebars and also on admin dashboard. But I want it […]

Metabox of one post influence setting on other

This great answer by David Gard allowed me to have a metabox sticky (checkbox) for posts that could only be set (checked) on one posts in the loop at a time. If post A has that meta box checked, then B, C … Z can’t have it checked. In order to be able to check […]