How to add table to custom post type as custom field in wordpress -


hi have tried tablepress, wp_table_reloaded plugins. feel complicated naive user add table adding shortcode each custom post's content there many custom posts in websiste. want table should added each custom post type add custom fields each custom post type,then adding value each field. please me!!!

take @ add_meta_box function: http://codex.wordpress.org/function_reference/add_meta_box

here's code used in recent project, believe should able adapt meta box add table.

add_action( 'admin_menu', 'create_meta_boxes' );  function create_meta_boxes() {   add_meta_box( 'author_info', 'auteur info', 'author_info_meta_box', 'portfolio', 'normal'); }  function author_info_meta_box( $object, $box ) { ?>   <p>     <label for="auteur-meta">auteur</label><br />     <input type="text" name="auteur-meta" id="auteur-meta" style="width:100%;" value="<?php echo wp_specialchars( get_post_meta( $object->id, 'auteur', true ), 1 ); ?>" />   </p>   <p>     <label for="auteur-quote-meta">quote auteur</label><br />     <input type="text" name="auteur-quote-meta" id="auteur-quote-meta" style="width:100%;" value="<?php echo wp_specialchars( get_post_meta( $object->id, 'auteur quote', true ), 1 ); ?>" />   </p>   <p>     <label for="auteurbiometa">biografie auteur</label><br />     <?php $settings = array(       'media_buttons' => false,       'textarea_rows' => 6     ); ?>     <?php wp_editor( wp_specialchars( get_post_meta( $object->id, 'auteur biografie', true ), 1 ), 'auteurbiometa' , $settings); ?>   </p>   <p>     <label for="order-mail-meta">e-mail voor bestellingen</label><br />     <input type="text" name="order-mail-meta" id="order-mail-meta" style="width:100%;" value="<?php echo wp_specialchars( get_post_meta( $object->id, 'order mail', true ), 1 ); ?>" />   </p> <?php }  //insert values on save add_action( 'save_post', 'save_post', 10, 2 ); function save_post( $post_id, $post ) {   if ( !current_user_can( 'edit_post', $post_id ) )     return $post_id;    update_post_meta( $post_id, 'auteur', stripslashes( $_post['auteur-meta'] ) );   update_post_meta( $post_id, 'auteur biografie', stripslashes( $_post['auteurbiometa'] ) );   update_post_meta( $post_id, 'auteur quote', stripslashes( $_post['auteur-quote-meta'] ) );   update_post_meta( $post_id, 'order mail', stripslashes( $_post['order-mail-meta'] ) ); } 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -