Tag Info

New answers tagged

0

I just ran into this issue recently. If you are using a Custom List Table (A/K/A WP List Table) within a Meta Box (located on the post edit screen post.php or post-new.php.) The reason you get redirected to the posts listing screen (edit.php) is because you're Custom List Table generates a hidden nonce field, which is also generated by the post.php or ...


0

you have to use "esc_attr" in case your value contains a quote for exemple <?php echo esc_attr(get_post_meta(...));?>


0

I have found what is the problem. It isn't enough to localize just the labels e.g. ('Label','text_domain'). But also the variable itself - my code should be like this: add_meta_box($this->_meta_box['id'], ($this->_meta_box['title'],'text_domain'), array(&$this, $this->_meta_box['function_callback']), $page, ...


0

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 anywhere and then add the new properties. Create a file called ...


1

add_action("admin_init", "admin_init"); add_action('save_post', 'save_reference_id'); /*** add_meta_box ***/ function admin_init(){ // adding a custom field to post type 'case' add_meta_box("refInfo-meta", "Reference", "meta_options", "case", "side", "high"); } /*** callback ***/ function meta_options(){ ?> <select name="page_id" ...


0

Yes, it is possible to limit the drag and drop functionality of your boxes. All one needs to do is find the right selectors for the specific boxes it wants to target. When you use $(".meta-box-sortables").[...] you are targeting all elements in the page with the class of meta-box-sortables. If, however, you add a custom class to any of those boxes, for ...


3

Wrong Assumptions @Rarst or @Dan-Cameron answers may work, but assume that when you are viewing a post type editing page, the metaboxes for the other post type are all registered. There are different case in which that won't happen: If metaboxes are registered using "add_meta_boxes_{$post_type}" hook, instead of the more common, generic "add_meta_boxes" ...


0

This will insert the metaboxes manually in close enough locations to where the meta boxes should go. The problem is that they'll be inserted before the standard mboxes for that post type. I'm sure you could hack with it more if necessary but this at least gets the basics of what you need. function monkey_advanced_meta_boxes() { $post = get_post( 2457 ...


0

I will make no claim this is reliable, but this is about how far I got: add_action( 'add_meta_boxes', function () { global $wp_meta_boxes; foreach ( $wp_meta_boxes['steal-from'] as $context => $priorities ) { foreach ( $priorities as $priority => $boxes ) { if ( ! isset( $wp_meta_boxes['metabox-stealer'][ $context ] ) ) ...


0

Create an additional metabox (checkbox, I'm thinking) that provides the option to create an 'edit' post type from this post. For the sake of this code, we'll call it 'transfer_data'. Change the value of $post_type to the post type of the original post that we will be retrieving the data from. I've added the functionality to save the original post ID ...


0

There is no "fields" argument to add_meta_box(), which I assume is what you are using and not some code-bloat-ie helper function/class nonsense. And you've not identified a callback, which is the key. Create a callback and put your "warning" array in that, along with code to create your checkboxe/radio-boxes, or whatever you need. $wpar_meta_box = array( ...


1

I've tried with jQuery but my code is hard to maintain and cannot reusable, so I've taken several hours to look for a plugin and found Meta Box Conditional Logic. For your meta box, if you use Meta Box Conditional Logic, just update your code to: $meta_boxes[] = array( 'id' => 'standard_lead', 'title' => 'Standard Lead', 'pages' => ...


0

Replace add_custom_metadata_boxes() to following:- //Add custom metadata function add_custom_metadata_boxes() { $screens = array( 'foo1' );//Here add custom post type value foreach ( $screens as $screen ) { if($screen == 'foo1'){ add_meta_box( 'custom_meta_box', // $id 'Values', ...


0

So, after an annoyingly long struggle, I discovered that I needed to have the script enqueued/registered with no dependencies. So in the end, to make it work, I needed this: function add_admin_scripts( $hook ) { global $post; wp_register_script( 'sectioned_page_script', get_stylesheet_directory_uri() . '/js/sectioned_page.js' ); if ( $hook == ...


0

This is how to do it for all post types: add_action( 'do_meta_boxes', 'remove_default_custom_fields_meta_box', 1, 3 ); function remove_default_custom_fields_meta_box( $post_type, $context, $post ) { remove_meta_box( 'postcustom', $post_type, $context ); }


2

I did similar thing recently but used the wp.media instead of ThickBox https://codex.wordpress.org/Javascript_Reference/wp.media with the same code from Codex. The only thing to make it work with multiple inputs is to move the frame variable from global scope to click function, so the 'frame' will be fresh for each click.


0

I figures this out. Here is the code that worked: $images = rwmb_meta( 'mostfilms_onesheet', 'type=image_advanced&size=full' ); foreach ( $images as $image ) { echo "<img src='{$image['url']}' width='{$image['width']}' height='{$image['height']}' alt='{$image['alt']}' />"; }


0

Try this: get_post_meta(get_the_id(),'hjemmeside', true); Assumes hjemmeside is the name of your custom field key.


0

Hey here is a plugin that adds your own meta data to your pages https://wordpress.org/plugins/add-meta-tags/ Here is how to remove them. http://www.paulund.co.uk/remove-wordpress-meta-tags Let us know how you come along :)



Top 50 recent answers are included