New answers tagged

0

For current Wordpress version (4.5.3) I come up with the following solution which removes closing metaboxes handler and opens all previously closed metaboxes. php (plugin.php) function add_admin_scripts( $hook ) { wp_register_script( 'disable_metabox_toggling', plugin_dir_url(__FILE__) . 'index.js', 'jquery', '1.0.0', true); wp_enqueue_script( '...


0

You can also use add_meta_box to add predefined boxes to different places in the admin, as long as you know the right handles. In the case of the comments meta box you need: add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', $screen, 'normal'); Here post_comments_meta_box is the callback function that fills the metabox. I am supposing ...


3

Looking at the files that create the metabox, there isn't anything to really hook into that will allow us to add the description so we'll need to use jQuery. Since the script is extremely small, I've opted not to put it into an external file but instead use the admin_footer hook: /** * Prepend taxonomy descriptions to taxonomy metaboxes */ function ...


0

I also don't understand what rwmb_meta() does, but I can see a couple obvious problems in the code as written. Apparently, you want the foreach to deliver as many "posts" as it finds $image in $images, and echo a result each time. If so, you would remove the bracket from: $schedule_image_url = $image['url']; } and place it after each $image ...


0

I don't know what rwmb_meta() does. But if rwmb_meta('tbf_scheduledatetime') returns array, then try something like this: ... $images = rwmb_meta( 'tbf_scheduleimage', 'type=image&size=full'); $dates = rwmb_meta('tbf_scheduledatetime'); var_dump( $dates ); ... You'll probably want to loop thru $dates and repeat the post data for each element in $...


0

Textareas behave quite different to text inputs in the browser rendering engine. I cannot figure out the use case of a single line textarea without scroll bars. If you want to copy the default text input behaviour to all effects, what is wrong with using a simple input type="text" instead for your custom field? If you intend to keep the textarea multiline ...


1

As of WP 3.7 (https://core.trac.wordpress.org/ticket/14206) you can add this argument to register_taxonomy: 'meta_box_cb' => 'post_categories_meta_box' to get the built-in checkbox category style metabox without having to make your taxonomy hierarchical. Also you could instead provide your own callback function to create your own metabox (i.e. with a ...


1

@Jeffrey's answer is correct is you are the one registering the post types, simply remove the support argument for comments. But if you want to remove it from all custom post types (that may be registered by plugins too) you can do: $cptslugs = get_post_types( array('public'=>false, '_builtin' => false) , 'names', 'and'); foreach ($cptslugs as $cpt) {...


0

The standard meta boxes that are shown on Custom Post Types are determined by the support you've given to the post type in the register_post_type() function. The function has a supports argument that takes an array as value. In this array simply remove 'comments' and it won't show the comments meta boxes.


0

You can use what you have with slight modification. Just increase the height of the meta box and let your users enter an item on each line. Embed $recipe_embed = get_post_meta( $post->ID, "recipe_embed", true ); if ( ! empty( $recipe_embed ) ): ?> <div style="background: green;"> <?php // normalize returns $...


0

It's unclear from your question what the actual problem is; on a hunch, should it be this: if ( ! empty( $entries[ $key ]['newblock_url'] ) ) : ... instead of: if ( get_post_meta( $post->ID, 'newblock_url', true ) ) :


0

In your loop while(have_posts() ) : the_post(); you are unconditionally going through all posts, but since the loop stops after the_post() nothing actually happens. So that's where the condition has to go: while(have_posts() ) { the_post(); if ($daysleft >= 0) { ... other actions } } Your code looks a bit incomplete to me, ...


0

WordPress has remove_meta_box() function. You can use it to remove meta box like function remove_post_meta_box() { remove_meta_box( 'meta_box_id' , 'post' , 'normal' ); } add_action( 'admin_menu' , 'remove_post_meta_box' );


-1

use these: $imgurl = isset( $values['upload_image'] ) ? esc_attr( $values['upload_image'][0] ) : ''; <input id="upload_image" type="text" size="36" name="upload_image" value="<?php echo $imgurl; ?>" /> <input id="upload_image_button" type="button" value="Upload Image" /> if( isset( $_POST['upload_image'] ) ) update_post_meta( $...



Top 50 recent answers are included