Show search for data extracted from metabox
$book_args = array( ‘post_type’ => ‘book’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘name_ebook’, ‘meta_value’ => ‘Paintree’ );
$book_args = array( ‘post_type’ => ‘book’, ‘posts_per_page’ => -1, ‘meta_key’ => ‘name_ebook’, ‘meta_value’ => ‘Paintree’ );
The following example is adding a meta box to the post edit screen and the wporg_cpt edit screen. function wporg_add_custom_box() { $screens = [‘post’, ‘wporg_cpt’]; foreach ($screens as $screen) { add_meta_box( ‘wporg_box_id’, // Unique ID ‘Custom Meta Box Title’, // Box title ‘wporg_custom_box_html’, // Content callback, must be of type callable $screen // Post type … Read more
According to the documentation for remove_action() the function name and priority must match the usage where the function was hooked. You have made a common sense assumption that a higher priority should be used for the removal but I believe that is the cause of the problem. Docs: https://developer.wordpress.org/reference/functions/remove_action/ To remove a hook, the $function_to_remove … Read more
Never mind. I found a version of Magic Fields that supports custom post types. You can find it here: https://github.com/attitude/Magic-Fields It looks like it is just a mod on Magic Fields to allow custom post types. And it works good so far
The metabox div gets an ID of ‘meta_’ + your metabox ID, thus: Sorry, that was me looking at my own metaboxes, forgetting that I actually prefix them like that to differentiate the container from elements within the container 🙁 Let’s work through your code and see if we can find the answer. First, your … Read more
Maybe they are just disabled? I’ve already seen a lot of people tripping over this one: On the top right of the edit screen you can see “Screen Options”. If you open this section you can enable and disable meta boxes. Maybe yours is deactivated? Source: Screen Options
Here is few steps: Right click on your area what you want to change/remove and inspect in console. Find in console HTML part what you want change/remove Look if have some ID or unique class. If you find some unique ID or class, just simple add custom CSS in your template with property display:none !important; … Read more
You could hook into theme_{$post_type}_templates and add an identical “default” option at the end: add_action(‘theme_page_templates’, ‘wpse_296283_theme_page_templates’); function wpse_296283_theme_page_templates($post_templates){ $post_templates[‘default’] = “Default Template”; return $post_templates; } Then you’d hide the first one with CSS: add_action(‘admin_head’ ‘wpse_296283_admin_head’); function wpse_296283_admin_head(){ ?> <style>#page_template option:first-child {display: none;}</style> <?php }
In CMB2 you can use the group type to create a repeating fields, then inside the group, you declare the text_date type. Let’s say you have an Events where you set multiple dates. $events = new_cmb2_box([ ‘id’ => ‘events_metabox’, ‘title’ => __(‘Events’, ‘text_domain’), ‘object_types’ => …, ‘show_on’ => …, … ]); $events_group_id = $events->add_field([ ‘id’ … Read more
WP Alchemy and Advanced custom fields both support this feature already.