Пример #1
0
  * Initiate your meta box
  */
 $my_meta = new Tax_Meta_Class($config);
 /*
  * Add fields to your meta box
  */
 //text field
 $my_meta->addText($prefix . 'text_field_id', array('name' => __('My Text ', 'tax-meta'), 'desc' => 'this is a field desription'));
 //textarea field
 $my_meta->addTextarea($prefix . 'textarea_field_id', array('name' => __('My Textarea ', 'tax-meta')));
 //checkbox field
 $my_meta->addCheckbox($prefix . 'checkbox_field_id', array('name' => __('My Checkbox ', 'tax-meta')));
 //select field
 $my_meta->addSelect($prefix . 'select_field_id', array('selectkey1' => 'Select Value1', 'selectkey2' => 'Select Value2'), array('name' => __('My select ', 'tax-meta'), 'std' => array('selectkey2')));
 //radio field
 $my_meta->addRadio($prefix . 'radio_field_id', array('radiokey1' => 'Radio Value1', 'radiokey2' => 'Radio Value2'), array('name' => __('My Radio Filed', 'tax-meta'), 'std' => array('radionkey2')));
 //date field
 $my_meta->addDate($prefix . 'date_field_id', array('name' => __('My Date ', 'tax-meta')));
 //Time field
 $my_meta->addTime($prefix . 'time_field_id', array('name' => __('My Time ', 'tax-meta')));
 //Color field
 $my_meta->addColor($prefix . 'color_field_id', array('name' => __('My Color ', 'tax-meta')));
 //Image field
 $my_meta->addImage($prefix . 'image_field_id', array('name' => __('My Image ', 'tax-meta')));
 //file upload field
 $my_meta->addFile($prefix . 'file_field_id', array('name' => __('My File ', 'tax-meta')));
 //wysiwyg field
 $my_meta->addWysiwyg($prefix . 'wysiwyg_field_id', array('name' => __('My wysiwyg Editor ', 'tax-meta')));
 //taxonomy field
 $my_meta->addTaxonomy($prefix . 'taxonomy_field_id', array('taxonomy' => 'category'), array('name' => __('My Taxonomy ', 'tax-meta')));
 //posts field
Пример #2
0
  */
 $config = array('id' => 'mango_meta_box', 'title' => 'Mango Meta Box', 'context' => 'advanced', 'pages' => array("product_cat", "product_tag"), 'fields' => array(), 'local_images' => false, 'use_with_theme' => mango_uri . '/inc/plugins/taxonomy_meta_class');
 $mango_product_meta = new Tax_Meta_Class($config);
 $mango_product_meta->addSelect($prefix . 'product_cat_columns', array('' => __('Default', 'mango'), '1' => "1", '2' => "2", '3' => "3", '4' => "4", '5' => "5", '6' => "6"), array('name' => __('Product Columns', 'mango')));
 $mango_product_meta->addSelect($prefix . 'product_cat_view', array('' => __('Default', 'mango'), 'v_1' => __("Grid Style 1", 'mango'), 'v_2' => __("Grid Style 2", 'mango'), 'v_3' => __("Grid Style 3", 'mango'), 'v_4' => __("Grid Style 4", 'mango'), 'list' => __("List", 'mango'), 'list_right' => __("List Right Aligned", 'mango')), array('name' => __('Product Page Style', 'mango')));
 $config2 = array('id' => 'mango_meta_box', 'title' => 'Mango Meta Box', 'context' => 'advanced', 'pages' => array('category', 'post_tag', 'product_cat', 'product_tag', 'portfolio-category', 'faq-category'), 'fields' => array(), 'local_images' => false, 'use_with_theme' => mango_uri . '/inc/plugins/taxonomy_meta_class');
 // $config[ 'page' ] = ;        // taxonomy name, accept categories, post_tag and custom taxonomies
 /*
  * Initiate your meta box
  */
 $mango_meta = new Tax_Meta_Class($config2);
 /*
  * Add fields to your meta box
  */
 //radio field
 $mango_meta->addRadio($prefix . 'taxonomy_layout', array('default' => __('Default Layout', 'mango'), 'left' => __('Left Sidebar', 'mango'), 'right' => __('Right Sidebar', 'mango'), 'both' => __('Both Sidebar', 'mango'), 'no' => __('Full Width', 'mango')), array('name' => __('Page Layout', 'mango'), 'std' => array('default')));
 $wp_registered_sidebar = wp_get_sidebars_widgets();
 $mango_sidebar[] = __("Default", 'mango');
 foreach ($wp_registered_sidebar as $sidebar => $sidebar_info) {
     if ($sidebar == 'wp_inactive_widgets') {
         continue;
     }
     $mango_sidebar[$sidebar] = ucwords(str_replace(array('_', '-'), ' ', $sidebar));
 }
 $mango_meta->addSelect($prefix . 'taxonomy_left_sidebar', $mango_sidebar, array('name' => __('Left Sidebar', 'mango')));
 $mango_meta->addSelect($prefix . 'taxonomy_right_sidebar', $mango_sidebar, array('name' => __('Right Sidebar', 'mango')));
 $mango_meta->addRadio($prefix . 'taxonomy_banner_type', array('' => __('No Banner', 'mango'), 'image' => __('Image', 'mango'), 'video' => __('Video', 'mango'), 'rev_slider' => __('Revolution Slider', 'mango'), 'custom_banner' => __('Custom Banner', 'mango')), array('name' => __('Banner Type', 'mango'), 'std' => array('')));
 //Image field
 $mango_meta->addImage($prefix . 'taxonomy_banner_image', array('name' => __('Banner Image ', 'mango'), 'desc' => __('Only useful when the banner type is Image', 'mango'), 'height' => '400px'));
 //text field
 $mango_meta->addText($prefix . 'taxonomy_banner_video', array('name' => __('Banner video URL', 'mango'), 'validate_func' => "mango_validate_url", 'style' => 'width: 100% !important;', 'desc' => __('Only useful when the banner type is Video. Add a valid flash video url like: youtube, vimeo, dailymotion etc. If you put an invalid url the data will not be saved.', 'mango')));
Пример #3
0
<?php

if (!function_exists('cf_rotator')) {
    function cf_rotator()
    {
        $labels = array('name' => _x('Rotators', 'Post Type General Name', 'cf'), 'singular_name' => _x('Rotator', 'Post Type Singular Name', 'cf'), 'menu_name' => __('Rotators', 'cf'), 'parent_item_colon' => __('Parent Rotator:', 'cf'), 'all_items' => __('All Rotators', 'cf'), 'view_item' => __('View Rotator', 'cf'), 'add_new_item' => __('Add New Rotator', 'cf'), 'add_new' => __('Add New', 'cf'), 'edit_item' => __('Edit Rotator', 'cf'), 'update_item' => __('Update Rotator', 'cf'), 'search_items' => __('Search Rotators', 'cf'), 'not_found' => __('Not found', 'cf'), 'not_found_in_trash' => __('Not found in Trash', 'cf'));
        $args = array('label' => __('rotator', 'cf'), 'description' => __('Content Rotators', 'cf'), 'labels' => $labels, 'supports' => array('title', 'editor', 'thumbnail'), 'taxonomies' => array('group'), 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_nav_menus' => true, 'show_in_admin_bar' => true, 'menu_position' => 22, 'menu_icon' => 'dashicons-slides', 'can_export' => false, 'has_archive' => false, 'exclude_from_search' => true, 'publicly_queryable' => true, 'capability_type' => 'page');
        register_post_type('rotator', $args);
    }
    add_action('init', 'cf_rotator', 0);
}
if (!function_exists('cf_rotator_groups')) {
    function cf_rotator_groups()
    {
        $labels = array('name' => _x('Groups', 'Taxonomy General Name', 'cf'), 'singular_name' => _x('Group', 'Taxonomy Singular Name', 'cf'), 'menu_name' => __('Group', 'cf'), 'all_items' => __('All Groups', 'cf'), 'parent_item' => __('Parent Group', 'cf'), 'parent_item_colon' => __('Parent Group:', 'cf'), 'new_item_name' => __('New Group Name', 'cf'), 'add_new_item' => __('Add New Group', 'cf'), 'edit_item' => __('Edit Group', 'cf'), 'update_item' => __('Update Group', 'cf'), 'separate_items_with_commas' => __('Separate groups with commas', 'cf'), 'search_items' => __('Search Groups', 'cf'), 'add_or_remove_items' => __('Add or remove groups', 'cf'), 'choose_from_most_used' => __('Choose from the most used groups', 'cf'), 'not_found' => __('Not Found', 'cf'));
        $args = array('labels' => $labels, 'hierarchical' => false, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_tagcloud' => false);
        register_taxonomy('group', array('rotator'), $args);
    }
    add_action('init', 'cf_rotator_groups', 0);
}
$config = array('id' => 'cf_rotator_meta', 'title' => 'Rotator Meta Box', 'pages' => array('group'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => true);
$cf_rotator = new Tax_Meta_Class($config);
$cf_rotator->addSelect('mode', array('horizontal' => 'Horizontal', 'vertical' => 'Vertical', 'fade' => 'Fade'), array('name' => 'Transition Mode', 'std' => array('horizontal')));
$cf_rotator->addText('speed', array('name' => 'Transition Speed', 'std' => '500', 'desc' => 'Type of transition between slides.'));
$cf_rotator->addRadio('loop', array('true' => 'True', 'false' => 'False'), array('name' => 'Infinite Loop', 'std' => array('true')));
$cf_rotator->addRadio('captions', array('true' => 'True', 'false' => 'False'), array('name' => 'Include Captions', 'std' => array('false')));
$cf_rotator->addRadio('ticker', array('true' => 'True', 'false' => 'False'), array('name' => 'Ticker Style', 'std' => array('false')));
$cf_rotator->addRadio('video', array('true' => 'True', 'false' => 'False'), array('name' => 'Include Video', 'std' => array('false')));
$cf_rotator->Finish();
    /*
     * prefix of meta keys, optional
     */
    $prefix = 'cda_';
    /* 
     * configure your meta box
     */
    $config_cat = array('id' => 'cda_meta_box_cat', 'title' => '', 'pages' => array('category'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => true);
    $config_post = array('id' => 'cda_meta_box_post', 'title' => ' ', 'pages' => array('proposta'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(), 'local_images' => false, 'use_with_theme' => true);
    /*
     * Initiate your meta box
     */
    $my_meta_cat = new Tax_Meta_Class($config_cat);
    $my_meta_post = new AT_Meta_Box($config_post);
    //radio field
    $my_meta_cat->addRadio($prefix . 'radio_field_id', array('piloto' => 'Projeto Piloto', 'conceito' => 'Projeto Conceito'), array('name' => __('Tipo do Projeto', 'tax-meta'), 'std' => array('conceito')));
    //Image field
    $my_meta_cat->addImage($prefix . 'image_field_id', array('name' => __('Imagem representativa ', 'tax-meta')));
    //Color field
    $my_meta_cat->addColor($prefix . 'color_field_id', array('name' => __('Cor representativa ', 'tax-meta')));
    //List of images to build background and slideshow image
    $my_meta_cat->addText($prefix . 'text_field_id', array('name' => __('Lista de ID para imagens a serem utilizadas no mosaico e slideshow ', 'tax-meta')));
    $my_meta_cat->addText($prefix . 'text_field_id_2', array('name' => __('Lista de ID de ícones do passo 3', 'tax-meta')));
    $my_meta_cat->addImage($prefix . 'image_2_field_id', array('name' => __('Mapa para Sugestões do Passo 3', 'tax-meta')));
    //Color field
    $my_meta_post->addColor($prefix . 'color_field_id_post', array('name' => 'Cor representativa '));
    //Finish Meta Box Decleration
    $my_meta_cat->Finish();
    $my_meta_post->Finish();
}
// Renomeia EXERPT para SUBTITULO