'ta-reviews-post-meta-box', 'title' => 'Review Settings', 'page' => $ta_post_cpt, 'context' => 'normal', 'priority' => 'high', 'fields' => array( array( 'name' => 'Name', 'desc' => 'Enter name of the product you are reviewing (required)', 'id' => $prefix . 'review_name', 'type' => 'text', 'std' => '' ), array( 'name' => 'Type', 'desc' => 'Enter product type (example: product by, software by, plugin by, book by, author, ...etc) (note: fill the author field below if you want to use option!)', 'id' => $prefix . 'review_type', 'type' => 'text', 'std' => '' ), array( 'name' => 'Author Name', 'desc' => 'Enter the product author name here', 'id' => $prefix . 'review_author', 'type' => 'text', 'std' => '' ), array( 'name' => 'Version', 'desc' => 'Enter product version', 'id' => $prefix . 'review_version', 'type' => 'text', 'std' => '' ), array( 'name' => 'URL', 'desc' => 'Enter review URL or Affiliate Link (including http://) (required)', 'id' => $prefix . 'review_url', 'type' => 'text', 'std' => '' ), array( 'name' => 'Price', 'desc' => 'Enter price of reviewd item', 'id' => $prefix . 'review_price', 'type' => 'text', 'std' => '' ), array( 'name' => 'Review Summary', 'desc' => 'Enter review summary (required)', 'id' => $prefix . 'review_summary', 'type' => 'textarea', 'std' => '' ), array( 'name' => 'Select Rating (out of 5)', 'id' => $prefix . 'review_rating', 'type' => 'select', 'options' => array('', '1', '2', '3', '4', '5'), 'std' => '' ), ) ); add_action('admin_menu', 'ta_mytheme_post_add_box'); // Add meta box function ta_mytheme_post_add_box() { global $wpar_meta_box; add_meta_box($wpar_meta_box['id'], $wpar_meta_box['title'], 'ta_mytheme_post_show_box', $wpar_meta_box['page'], $wpar_meta_box['context'], $wpar_meta_box['priority']); } // Callback function to show fields in meta box function ta_mytheme_post_show_box() { global $wpar_meta_box, $post; // Use nonce for verification echo ''; echo '
| ', ' | ';
switch ($field['type']) {
case 'text':
echo '',
' ', $field['desc']; break; case 'textarea': echo '', ' ', $field['desc']; break; case 'select': echo ''; $rating = $meta ? $meta : 0; $rating_star = (int) $rating * 20; echo ' '; break; } echo ' | ', ' |
|---|