Migrating from metaboxes to wp_editor()

It works just the same like a regular textarea with the exception of the data being escaped so when you call for the saved data just make sure to decode the html entities using html_entity_decode here is a very simple demo class, take a look at how the field is created. if (!class_exists(‘wp_editor_meta_box’)){ class wp_editor_meta_box{ … Read more

multi custom fields and taxonomy search

I’m not sure if I fully understand what you’re trying to do, but I always recommend the Advanced Custom Fields plugin to people looking to make custom fields more useful and intuitive. Great plugin with great support and documentation. It really opens up a lot of possibilities.

How to make a meta box?

Imho, the fastest way would be by using the Meta Box Wrapper Class, which is a plugin by now. Download and activate it. Next in your functions.php add the following: $prefix = ‘cheas_cool_metabox_’; global $meta_boxes; $meta_boxes = array(); $meta_boxes[] = array( ‘id’ => ‘movie_reviews’, ‘title’ => ‘Movie Review’, //Change the next line if you want … Read more

populate array with posts

After getting the posts you can easily put them in another array & then return that array function get_sponsors() { $args = array( ‘numberposts’ => -1, ‘post_type’ => ‘movies’ ); $my_movies = get_posts($args); $options = array(); foreach($my_movies as $m) $options[$m->ID] = array( ‘label’ => $m->post_title, ‘value’ => $m->ID ); return $options; }

A meta box (in a custom post type) with two different type of fields

If you save the contents of the two input fields into one post_meta value you are able to call them at once. In the save_post action $text = esc_attr( $_POST[‘text’] ); $select = esc_attr( $_POST[‘select’] ); // saves the value as “text select” $combined = trim( sprintf( ‘%1$s %2$s’, $text, $select ) ); update_post_meta( $post_id, … Read more

Saving Meta Data within Custom Post Type

I would try using the post ID that’s automatically passed to save_events, rather than the $post global. So: function save_events( $post_id ){ if ( !wp_verify_nonce( $_POST[‘events-nonce’], ‘events-nonce’ )) { return $post_id; } if ( !current_user_can( ‘edit_post’, $post_id )) return $post_id; update_post_meta($post_id, “events_price”, $POST[‘events_price’] ); update_post_meta($post_id, “events_location”, $POST[‘events_location’] ); } I’m not sure the global $post … Read more