예제 #1
0
$testimonial = new Cuztom_Post_Type('testimonial', array("label" => 'Testimonials', 'has_archive' => true, 'supports' => array('title', 'excerpt', 'thumbnail')));
$testimonial->add_meta_box('testimonial_author_info', 'Testimonial Author Information', array(array('name' => 'testimonial_author_name', 'label' => 'Testimonial Author Name', 'description' => 'Put the author name here', 'type' => 'text')));
$chef = new Cuztom_Post_Type('chef', array('menu_position' => 9, 'has_archive' => true, 'supports' => array('title', 'editor', 'thumbnail', 'comments'), 'taxonomies' => array('category', 'post_tag')));
$chef->add_meta_box('chef_meta_box', 'General Information', array(array('name' => 'name', 'label' => 'Name of the Chef:', 'description' => 'Enter Name e.g: Abu Antar', 'type' => 'text'), array('name' => 'designation', 'label' => 'designation of the Chef:', 'description' => 'Enter designation e.g: Master chef', 'type' => 'text'), array('name' => 'Experience', 'label' => 'Experience:', 'description' => 'Enter experience e.g: 20 years', 'type' => 'text'), array('name' => 'School', 'label' => 'School:', 'description' => 'Enter School name e.g: Paris Cuisine University', 'type' => 'text'), array('name' => 'Speciality', 'label' => 'Speciality:', 'description' => 'Speciality e.g: Modern French Cuisine', 'type' => 'text'), array('name' => 'Favourite', 'label' => 'Favourite Cuisine:', 'description' => 'Favourite Cuisine e.g: Asian Traditional', 'type' => 'text'), array('name' => 'Cooks', 'label' => 'Cooks for us:', 'description' => 'e.g: 7 years', 'type' => 'text'), array('name' => 'Staff', 'label' => 'Staff Managed:', 'description' => 'e.g: 15 Persons', 'type' => 'text'), array('name' => 'takeaway_preview_image', 'label' => 'Preview image:', 'description' => 'Upload image 360 x 375 for best view ', 'type' => 'image')));
$news = new Cuztom_Post_Type('news', array('menu_position' => 10, 'taxonomies' => array('category', 'post_tag'), 'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments')));
$news->add_meta_box('news_meta_box', 'Location', array(array('name' => 'country', 'label' => 'Name of the country:', 'type' => 'text'), array('name' => 'region', 'label' => 'Region:', 'type' => 'text'), array('name' => 'zip', 'label' => 'Zip Code:', 'type' => 'text')));
$news->add_meta_box('ingrediant_meta_box', 'Ingrediant', array(array('name' => 'checkbox', 'label' => 'Ingrediant on/off', 'description' => 'Do you want ingrediant field?', 'type' => 'checkbox', 'default_value' => 'on'), array('name' => 'ingrediant', 'label' => 'Ingrediants:', 'description' => 'name ingrediants by separating comma.', 'type' => 'text')));
$front_page_meta = new Cuztom_Post_Type('page');
$args = array('post_type' => 'block', 'posts_per_page' => -1);
$get_all_block_posts = get_posts($args);
$all_block_posts = array();
foreach ($get_all_block_posts as $key => $value) {
    $all_block_posts[$value->ID] = $value->post_title;
}
$front_page_meta->add_meta_box('front_page_meta_box', 'All Block Posts', array(array('name' => 'name_select', 'label' => 'Multiple Select', 'description' => 'select multiple post to show in the front page', 'type' => 'multi_select', 'options' => $all_block_posts, 'default_value' => 'value2')));
$product = new Cuztom_Post_Type('product');
$args = array('rewrite' => array('slug' => 'cuisines'));
$product->add_taxonomy('Cuisines', $args);
// $takeaway_grp_price = new Cuztom_Post_Type( 'product' );
// $takeaway_grp_price->add_meta_box(
//   'price_for_grouped_product',
//   'Price for the main product',
//    array(
//             array(
//                 'label' => __('Main Price ', 'takeaway'),
//                 'name' => 'grp_product_price',
//                 'type' => 'text',
//                 'description' => __('If you want variation then please do not add main price' , 'takeaway'),
//             ),
//           )
//  );
예제 #2
0
<?php

//Create product custom post type
$products = new Cuztom_Post_Type('product');
add_action('init', 'product_remove_post_type_support', 10);
function product_remove_post_type_support()
{
    remove_post_type_support('product', 'editor');
    remove_post_type_support('product', 'custom-fields');
}
$products->add_taxonomy('Body system');
$products->add_taxonomy('Indication');
$products->add_meta_box('Product Details', 'product_details', array(array('name' => 'folk_name', 'label' => 'Folk Name', 'description' => 'Please enter folk name for this herb.', 'type' => 'text'), array('name' => 'expensive_herb', 'label' => 'Expensive Herb', 'description' => 'Is this herb expensive? Pick expensive or extra expensive.', 'type' => 'select', 'options' => array('' => 'Select expensive or extra expensive', '*' => 'Expensive', '**' => 'Extra Expensive')), array('name' => 'monograph_link', 'label' => 'Monograph Link', 'description' => 'Please enter monograph link for this herb.', 'type' => 'text'), array('name' => 'warnings', 'label' => 'Warnings & Interactions', 'description' => '', 'type' => 'wysiwyg'), array('name' => 'dosage', 'label' => 'Dosage', 'description' => '', 'type' => 'wysiwyg')));
//Add or Remove column into Product Page
// add_filter('manage_edit-product_columns', 'product_list_into_product_list');
// function product_list_into_product_list($defaults) {
// unset($defaults['product_tag']);
// $defaults['_product_details_folk_name'] = 'Folk name';
// return $defaults;
// }
// Show Coloumn for Products List into Admin
add_filter('manage_product_posts_columns', 'hype_columns_head_only_products', 10);
add_action('manage_product_posts_custom_column', 'hype_columns_content_only_products', 10, 2);
// Functions for Products List into Admin
function hype_columns_head_only_products($defaults)
{
    unset($defaults['product_tag']);
    $defaults['_product_details_folk_name'] = 'Folk';
    return $defaults;
}
function hype_columns_content_only_products($column_name, $post_ID)