Пример #1
0
 //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
 $my_meta->addPosts($prefix . 'posts_field_id', array('args' => array('post_type' => 'page')), array('name' => __('My Posts ', 'tax-meta')));
 /*
  * To Create a reapeater Block first create an array of fields
  * use the same functions as above but add true as a last param
  */
 $repeater_fields[] = $my_meta->addText($prefix . 're_text_field_id', array('name' => __('My Text ', 'tax-meta')), true);
 $repeater_fields[] = $my_meta->addTextarea($prefix . 're_textarea_field_id', array('name' => __('My Textarea ', 'tax-meta')), true);
 $repeater_fields[] = $my_meta->addCheckbox($prefix . 're_checkbox_field_id', array('name' => __('My Checkbox ', 'tax-meta')), true);
 $repeater_fields[] = $my_meta->addImage($prefix . 'image_field_id', array('name' => __('My Image ', 'tax-meta')), true);
 /*
Пример #2
0
    die;
}
// Enqueue all header scripts
function vtms_enqueue_scripts()
{
    wp_enqueue_style('parent', get_template_directory_uri() . '/stylesheets/styles.css', array(), get_current_version());
}
add_action('wp_enqueue_scripts', 'vtms_enqueue_scripts');
/* ---------------------------------- TAXONOMY META */
$tax_meta_prefix = meta_prefix();
$config = array('id' => 'category-meta', 'title' => 'Category Meta Box', 'pages' => array('category'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => true);
$cat_meta = new Tax_Meta_Class($config);
// Category Color
$cat_meta->addText($tax_meta_prefix . 'color', array('name' => __('color', 'tax-meta')));
// Category Featured Image
$cat_meta->addFile($tax_meta_prefix . 'image', array('name' => __('image', 'tax-meta')));
/* ---------------------------------- (end) TAXONOMY META */
/* ---------------------------------- GET CATEGORY META */
function get_category_meta($post_id = NULL, $cat_id = NULL)
{
    // Return array
    $final = array();
    // All category IDs
    $categories = wp_get_post_categories($post_id);
    if (isset($categories[0]) || !is_null($cat_id)) {
        $has_category = true;
        // Get the TERM for the category
        if (isset($categories[0])) {
            $term = get_term_by('id', $categories[0], "category");
            $final['cat_id'] = $categories[0];
        } else {
 //checkbox field
 $my_meta->addCheckbox($prefix . 'checkbox_field_id', array('name' => 'My Checkbox '));
 //select field
 $my_meta->addSelect($prefix . 'select_field_id', array('selectkey1' => 'Select Value1', 'selectkey2' => 'Select Value2'), array('name' => 'My select ', 'std' => array('selectkey2')));
 //radio field
 $my_meta->addRadio($prefix . 'radio_field_id', array('radiokey1' => 'Radio Value1', 'radiokey2' => 'Radio Value2'), array('name' => 'My Radio Filed', 'std' => array('radionkey2')));
 //date field
 $my_meta->addDate($prefix . 'date_field_id', array('name' => 'My Date '));
 //Time field
 $my_meta->addTime($prefix . 'time_field_id', array('name' => 'My Time '));
 //Color field
 $my_meta->addColor($prefix . 'color_field_id', array('name' => 'My Color '));
 //Image field
 $my_meta->addImage($prefix . 'image_field_id', array('name' => 'My Image '));
 //file upload field
 $my_meta->addFile($prefix . 'file_field_id', array('name' => 'My File '));
 //wysiwyg field
 $my_meta->addWysiwyg($prefix . 'wysiwyg_field_id', array('name' => 'My wysiwyg Editor '));
 //taxonomy field
 $my_meta->addTaxonomy($prefix . 'taxonomy_field_id', array('taxonomy' => 'category'), array('name' => 'My Taxonomy '));
 //posts field
 $my_meta->addPosts($prefix . 'posts_field_id', array('args' => array('post_type' => 'page')), array('name' => 'My Posts '));
 /*
  * To Create a reapeater Block first create an array of fields
  * use the same functions as above but add true as a last param
  */
 $repeater_fields[] = $my_meta->addText($prefix . 're_text_field_id', array('name' => 'My Text '), true);
 $repeater_fields[] = $my_meta->addTextarea($prefix . 're_textarea_field_id', array('name' => 'My Textarea '), true);
 $repeater_fields[] = $my_meta->addCheckbox($prefix . 're_checkbox_field_id', array('name' => 'My Checkbox '), true);
 $repeater_fields[] = $my_meta->addImage($prefix . 'image_field_id', array('name' => 'My Image '), true);
 /*
Пример #4
0
 public static function metadata_customizations()
 {
     include_once PLS_Route::locate_blueprint_option('meta.php');
     //throws random errors if you aren't an admin, can't be loaded with admin_init...
     if (!is_admin() || !class_exists('Tax_Meta_Class')) {
         return;
     }
     $config = array('id' => 'demo_meta_box', 'title' => 'Demo Meta Box', 'pages' => array('state', 'city', 'zip', 'street', 'neighborhood'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false);
     $my_meta = new Tax_Meta_Class($config);
     foreach (self::$custom_meta as $meta) {
         switch ($meta['type']) {
             case 'text':
                 $my_meta->addText($meta['id'], array('name' => $meta['label']));
                 break;
             case 'textarea':
                 $my_meta->addTextarea($meta['id'], array('name' => $meta['label']));
                 break;
             case 'wysiwyg':
                 $my_meta->addCheckbox($meta['id'], array('name' => $meta['label']));
                 break;
             case 'image':
                 $my_meta->addImage($meta['id'], array('name' => $meta['label']));
                 break;
             case 'file':
                 $my_meta->addFile($meta['id'], array('name' => $meta['label']));
                 break;
             case 'checkbox':
                 $my_meta->addCheckbox($meta['id'], array('name' => $meta['label']));
                 break;
         }
     }
     $my_meta->Finish();
 }
<?php

/***
* custom fields for taxonomies
* using tax-meta-class plugin
**/
/**
Field(s) for Cities
**/
if (is_admin()) {
    $prefix = 'nt_';
    /* 
     * configure meta box
     */
    $config = array('id' => 'location_info', 'title' => 'Location Information', 'pages' => array('city'), 'context' => 'normal', 'fields' => array(), 'local_images' => true, 'use_with_theme' => false);
    $metabox = new Tax_Meta_Class($config);
    $metabox->addSelect($prefix . 'state-prov', array('' => 'Choose', 'AL' => 'Alabama', 'AK' => 'Alaska', 'AZ' => 'Arizona', 'AR' => 'Arkansas', 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', 'DC' => 'District Of Columbia', 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', 'WI' => 'Wisconsin', 'WY' => 'Wyoming', 'AS' => 'American Samoa', 'GU' => 'Guam', 'MP' => 'Northern Mariana Islands', 'PR' => 'Puerto Rico', 'UM' => 'United States Minor Outlying Islands', 'VI' => 'Virgin Islands', 'AB' => 'Alberta', 'BC' => 'British Columbia', 'MB' => 'Manitoba', 'NB' => 'New Brunswick', 'NL' => 'Newfoundland and Labrador', 'NS' => 'Nova Scotia', 'ON' => 'Ontario', 'PE' => 'Prince Edward Island', 'QC' => 'Quebec', 'SK' => 'Saskatchewan', 'NT' => 'Northwest Territories', 'NU' => 'Nunavut', 'YT' => 'Yukon'), array('name' => __('State/Province ', 'tax-meta'), 'std' => array('')));
    $metabox->addText($prefix . 'map_info', array('name' => __('Google Maps ', 'tax-meta'), 'desc' => 'Mapping info'));
    $metabox->addFile($prefix . 'city_img', array('name' => __('City Image ', 'tax-meta'), 'desc' => 'The image for the city'));
    $metabox->addCheckbox($prefix . 'feat_city', array('name' => __('Featured City ', 'tax-meta'), 'desc' => 'Featured city (y/n) (Shows up on home page)'));
    $metabox->Finish();
}