Tag Info

New answers tagged

0

You should call remove_meta_box in the add_meta_boxes hook to get it working. It tested on 4.0. add_action( 'add_meta_boxes', 'customize_admin_backend_cpt',0 ); function customize_admin_backend_cpt () { remove_meta_box( 'slugdiv', 'your_cpt_goes_here', 'normal' ); }


2

I found this somewhere in my code, I probably got it from another answer here: add_filter( 'get_user_option_meta-box-order_{YOUR_CPT}', 'metabox_order' ); function metabox_order( $order ) { return array( 'normal' => join( ",", array( 'customdiv-{YOUR_CPT}', 'authordiv', ...


0

This is the simplest method I have found. When creating your metabox, simply set the context to "advanced". Then, latch on to the edit_form_after_title hook - print your meta boxes out there, then remove it so it doesn't appear twice. // Move all "advanced" metaboxes above the default editor add_action('edit_form_after_title', function() { global ...


0

Make sure your custom post type slug is clients in $screens = array( 'clients' ); Because i have just tested your code in local and its working fine.


0

Your meta option is post_options_select. You are using wrong meta key options-select in function display_content. But main point is that, you cannot control the sidebar layout from the_content filter. If selected option is 'No Sidebar' then you need to hide sidebar in your template. the_content only contains the content of the post. How it should be ...


0

I personally now use on every project Advanced Custom Fields (http://advancedcustomfields.com/), it is well-maintained, easy to manage, extremely powerful and ever-evolving in terms of features. It has a free and a Pro version (right now the plugin creator is moving towards a new version where there is only Pro, not single Add-Ons). Your repeater field would ...


0

Use this metabox addon in your plugin. It is easy to use and add


1

This may be an alternative for you. The Advanced Custom Fields plug in has an Image Field, which allows images to be uploaded and selected. You can set the field to show on your Custom Post Type pages and also integrate a line of code into your template file. You can create as many image fields as needed. Learn more about the Image field here.


0

First of all, You don't have to add 'form' html tag in the metabox. You missed to pass the '$post' parameter to the function 'display_post_options' and you used selected() function wrong too. Here is the code after I updated it. function display_post_options( $post){ wp_nonce_field( basename( __FILE__ ), 'post_options_nonce' ); ...


0

Did you try this ?Hope this will work. add_filter( 'the_content', 'cd_display_quote' ); function cd_display_quote( $content ) { // We only want this on single posts, bail if we're not in a single post // if( !is_single() ) return $content; // We're in the loop, so we can grab the $post variable global $post; $data = ...


0

I got the answer. Now I have the code function fichasvtmbasicas_meta_box_callback( $post ) { wp_nonce_field( 'fichasvtmbasicas_meta_box', 'fichasvtmbasicas_meta_box_nonce' ); $fichasvtmbasicas_geracao_field = get_post_meta( $post->ID, '_vtmbasica_geracao_value_key', true ); echo '<div class="unidadeelementotopovtm"><label ...


1

Here is how you can move specific meta boxes above the editor, but before I post the code I just would like to thank Andrew and mhulse. You guys rock! function foo_deck( $post_type ) { if ( in_array( $post_type, array( 'post', 'page' ) ) ) { add_meta_box( 'contact_details_meta', 'Contact Details', ...


0

After I removed all the wp_nonce fields everything is working slightly. As far as I can remember, their job is to prevent sending requests from undesireable places and some actions. I guess I can't make a proper nonce verification.


0

It looks like you are trying to build a way to display a group of meta fields for your custom post type. Using get_post_custom you can fetch all the custom post meta for a single post in 1 request. Then using a combination of looping you can build your output as you see fit. A roughed in example of how this can be accomplished is below: ...


0

I figured it out myself so I will post the answer here, please note that the original answer can also be found on StackOverflow. If the mods feel like this should be deleted from here and only remain, please go ahead. I thought it might be useful on both places. First the correct code, then an explaination: // Here we add a new user role, "cliente". ...


0

Basics First you need to register the Google JSAPI script. Else you won't have access to it. And you will need to hook it to admin_enqueue_scripts to have it available in the meta box. Also the JSAP needs to get loaded before your custom script, so you need to set it as dependency. Example: add_action( 'admin_enqueue_scripts', 'pie_load_scripts' ); ...


0

I haven't tested this but the idea is to check the post status, if the post is not published, show the metabox otherwise don't. function non_publish_metaboxes() { global $post; if(!isset($post)) return; if($post->post_status !== 'publish'){ // ... Show Metabox } } add_action( 'add_meta_boxes', 'non_publish_metaboxes' ); ...


0

Instead of if ($post_id->post_category[0] == 18) try if ( $post_id && in_category( 18, $post_id ) ) Also the 'save_post' action should be add_action('save_post','my_meta_save', 10, 2); If you want the metabox to appear on a new post when the category is selected, then remove the outer category test if statement so that the metabox is always ...



Top 50 recent answers are included