Title: Custom Posts Working with Custom Write Panels?
Last modified: August 19, 2016

---

# Custom Posts Working with Custom Write Panels?

 *  [jezthomp](https://wordpress.org/support/users/jezthomp/)
 * (@jezthomp)
 * [16 years ago](https://wordpress.org/support/topic/custom-posts-working-with-custom-write-panels/)
 * This is basically ready for WP3 but i wondered if it can be done..
 * I have been using this custom write panel tut [ and want to combine it with the custom posts feature.](http://wefunction.com/2009/10/revisited-creating-custom-write-panels-in-wordpress/)
 * Here is my functions.php doing its job..
 *     ```
       /* Custom Post Details */
   
       register_post_type('post-test', array(
       		'label' => 'Post Test',
       		'public' => true,
       		'show_ui' => true,
       		'capability_type' => 'post',
       		'hierarchical' => false,
       		'rewrite' => array('slug' => ''),
       		'query_var' => true,
       		'supports' => array('title','editor','excerpt','thumbnail',)) );
   
       /* Custom Write Panel Details */
   
       $key = "key";
       $meta_boxes = array(
   
         /*Test Box*/
       "previous" => array(
       "name" => "test",
       "title" => "test link",
       "description" => "testing info"),
   
        /*Test Box*/
       "next" => array(
       "name" => "testing",
       "title" => "testing link",
       "description" => "testing info"),
       );  
   
       function create_meta_box() {
       global $key;
   
       if( function_exists( 'add_meta_box' ) ) {
       add_meta_box( 'new-meta-boxes', ucfirst( $key ) . ' Site Detail Options', 'display_meta_box', 'post', 'normal', 'high' );
       }
       }
   
       function display_meta_box() {
       global $post, $meta_boxes, $key;
       ?>
   
       <div class="form-wrap">
   
       <?php
       wp_nonce_field( plugin_basename( __FILE__ ), $key . '_wpnonce', false, true );
   
       foreach($meta_boxes as $meta_box) {
       $data = get_post_meta($post->ID, $key, true);
       ?>
   
       <div class="form-field form-required">
       <label for="<?php echo $meta_box[ 'name' ]; ?>"><?php echo $meta_box[ 'title' ]; ?></label>
       <input type="text" name="<?php echo $meta_box[ 'name' ]; ?>" value="<?php echo $data[ $meta_box[ 'name' ] ]; ?>" />
       <p><?php echo $meta_box[ 'description' ]; ?></p>
       </div>
   
       <?php } ?>
   
       </div>
       <?php
       }
   
       function save_meta_box( $post_id ) {
       global $post, $meta_boxes, $key;
   
       foreach( $meta_boxes as $meta_box ) {
       $data[ $meta_box[ 'name' ] ] = $_POST[ $meta_box[ 'name' ] ];
       }
   
       if ( !wp_verify_nonce( $_POST[ $key . '_wpnonce' ], plugin_basename(__FILE__) ) )
       return $post_id;
   
       if ( !current_user_can( 'edit_post', $post_id ))
       return $post_id;
   
       update_post_meta( $post_id, $key, $data );
       }
   
       add_action( 'admin_menu', 'create_meta_box' );
       add_action( 'save_post', 'save_meta_box' );
       ```
   
 * The problem is that the custom write panel only appears in the default posts,
   not my newly added custom post.
 * So is there anyway to tell the custom posts to include the custom write panel..?
 * Or no chance..

Viewing 1 replies (of 1 total)

 *  [erikw46](https://wordpress.org/support/users/erikw46/)
 * (@erikw46)
 * [15 years, 5 months ago](https://wordpress.org/support/topic/custom-posts-working-with-custom-write-panels/#post-1509671)
 * Just found this post while searching the forums for something similar… Im sure
   you have solved it yet but just in case…
 * change this code:
 *     ```
       if( function_exists( 'add_meta_box' ) ) {
       add_meta_box( 'new-meta-boxes', ucfirst( $key ) . ' Custom Post Options', 'display_meta_box', 'post', 'normal', 'high' );
       }
       }
       ```
   
 * to this:
 *     ```
       if( function_exists( 'add_meta_box' ) ) {
       add_meta_box( 'new-meta-boxes', ucfirst( $key ) . ' Custom Post Options', 'display_meta_box', '***customPosttitle***', 'normal', 'high' );
       }
       }
       ```
   
 * Replace ***customPosttitle*** with title you gave your custom post

Viewing 1 replies (of 1 total)

The topic ‘Custom Posts Working with Custom Write Panels?’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [erikw46](https://wordpress.org/support/users/erikw46/)
 * Last activity: [15 years, 5 months ago](https://wordpress.org/support/topic/custom-posts-working-with-custom-write-panels/#post-1509671)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
