public function __construct() { if (is_admin()) { // we need it for all data flexor taxonomies $ay_df_taxonomies = array(); $taxonomies = get_taxonomies(); foreach ($taxonomies as $taxonomy) { if ($this->endswith($taxonomy, '_dftype')) { $ay_df_taxonomies[] = $taxonomy; } } /* * configure your meta box */ $config = array('id' => 'df_meta_box', 'title' => 'Data Flexor', 'pages' => $ay_df_taxonomies, 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false); /* * Initiate your meta box */ $my_meta = new Tax_Meta_Class($config); //text field $my_meta->addText('df_custom_class', array('name' => __('Custom Class Name ', 'tax-meta'), 'desc' => 'Complete if using a dataflexor custom class for display')); //checkbox field $my_meta->addCheckbox('df_bp_post_activity', array('name' => 'Post in activity stream ')); /* * Don't Forget to Close up the meta box decleration */ //Finish Meta Box Decleration $my_meta->Finish(); } }
function add_location_type_meta() { /* * prefix of meta keys, optional */ $prefix = 'st_'; /* * configure your meta box */ $config = array('id' => 'st_extra_infomation', 'title' => __('Extra Information', ST_TEXTDOMAIN), 'pages' => array('st_location_type'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false); if (!class_exists('Tax_Meta_Class')) { STFramework::write_log('Tax_Meta_Class not found in class.attribute.php line 121'); return; } /* * Initiate your meta box */ $my_meta = new Tax_Meta_Class($config); /* * Add fields to your meta box */ //text field $my_meta->addSelect($prefix . 'label', array('default' => __('Default', ST_TEXTDOMAIN), 'primary' => __('Primary', ST_TEXTDOMAIN), 'success' => __('Success', ST_TEXTDOMAIN), 'info' => __('Info', ST_TEXTDOMAIN), 'warning' => __('Warning', ST_TEXTDOMAIN), 'danger' => __('Danger', ST_TEXTDOMAIN)), array('name' => __('Label Type', ST_TEXTDOMAIN))); //Image field //$my_meta->addImage($prefix.'image',array('name'=> __('Image ',ST_TEXTDOMAIN), // 'desc'=>__('If dont like the icon, you can use image instead',ST_TEXTDOMAIN))); //file upload field /* * Don't Forget to Close up the meta box decleration */ //Finish Meta Box Decleration $my_meta->Finish(); }
public function add_tax_groups_meta_box() { $config = array('id' => $this->netevl_libtools->create_id(array($this->postType, 'taxonomy_metabox')), 'title' => 'Nastavení', 'pages' => array('judikatura-zakony'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false); $this_tax_meta = new Tax_Meta_Class($config); $this_tax_meta->addText($this->netevl_libtools->create_id(array($this->postType, 'cislo_zakona')), array('name' => 'Číslo zákona')); $this_tax_meta->addText($this->netevl_libtools->create_id(array($this->postType, 'odkaz')), array('name' => 'Odkaz')); $this_tax_meta->Finish(); }
function wp_ccp_plugin_admin_init() { if (is_admin()) { $config = array('id' => 'wp_ccp_plugin_category_meta', 'title' => 'Custom Category Meta', 'pages' => array('category'), 'context' => 'normal', 'fields' => array(), 'local_images' => true, 'use_with_theme' => false); $my_meta = new Tax_Meta_Class($config); $my_meta->addSelect('custom_content_enabled', array('1' => __('Yes', 'wp_ccp_plugin'), '0' => __('No', 'wp_ccp_plugin')), array('name' => __('Use Custom Category Pages content for this category?', 'wp_ccp_plugin'), 'std' => array('0'))); $my_meta->addText('heading', array('name' => __('Category Headline', 'wp_ccp_plugin'))); $my_meta->addText('page_title', array('name' => __('Category Page Title', 'wp_ccp_plugin'))); $my_meta->addWysiwyg('copy', array('name' => __('Category Copy', 'wp_ccp_plugin'))); $my_meta->Finish(); } }
function wipCustomTaxonomy() { if (is_admin()) { $includeTaxonomyMeta = array('category'); // Array of taxonomy types to include the WIP custom taxonomy options $wipTaxonomy = get_taxonomies(array('public' => true, '_builtin' => false), 'objects'); // Find custom taxonomies, see if they include the WIP custom taxonomy options if ($wipTaxonomy) { foreach ($wipTaxonomy as $wipTaxonomy_value) { if (isset($wipTaxonomy_value->wip_taxonomy_options) && $wipTaxonomy_value->wip_taxonomy_options == true) { array_push($includeTaxonomyMeta, $wipTaxonomy_value->name); } } } // Custom fields for taxonomies $categoryMetaConfig = array('pages' => $includeTaxonomyMeta, 'use_with_theme' => true); $categoryMeta = new Tax_Meta_Class($categoryMetaConfig); $categoryMeta->addCheckbox('widget', array('name' => 'Widgetize', 'desc' => 'Add a widget area to the archive sidebar')); $categoryMeta->addCheckbox('widgetPost', array('name' => '', 'desc' => 'Extend the category widget area to its posts')); $categoryMeta->addCheckbox('magazine', array('name' => '', 'desc' => 'Digital magazine archive (displays sub-categories and posts therein)')); //$categoryMeta->addCheckbox( 'author', array( 'name'=> '', 'desc'=> 'Show post author on archive' ) ); //$categoryMeta->addCheckbox( 'pubDate', array( 'name'=> '', 'desc'=> 'Show post publish date on archive' ) ); //$categoryMeta->addCheckbox( 'taxonomy', array( 'name'=> '', 'desc'=> 'Show post categories and tags on archive' ) ); //$categoryMeta->addCheckbox( 'comment', array( 'name'=> '', 'desc'=> 'Show number of comments per post on archive' ) ); $categoryMeta->addText('navOverride', array('name' => 'Navigation Override', 'desc' => 'The URL of the navigation link to be set as current when viewing posts in this category')); $categoryMeta->addText('customCSS', array('name' => 'Custom CSS', 'desc' => 'The URL of a stylesheet to apply to posts in this category and its archive')); $categoryMeta->Finish(); } }
*/ require_once 'Tax-meta-class/Tax-meta-class.php'; if (is_admin()) { /** * lets make this happen -define my new meta box options #2 */ $config = array('id' => 'featured_image_metabox', 'title' => 'Tile Image', 'pages' => array('phototype'), 'context' => 'normal', 'fields' => array(), 'local_images' => true, 'use_with_theme' => true); /** * name the metabox #3 */ $tax_metabox = new Tax_Meta_Class($config); /** * Add image field to metabox #4 */ $tax_metabox->addImage('featured_image_metabox', array('name' => 'My Image ')); $tax_metabox->Finish(); add_filter("manage_edit-phototype_columns", 'taxonomy_columns'); function taxonomy_columns($theme_columns) { $new_columns = array('cb' => '<input type="checkbox" />', 'name' => __('Title'), 'triangle_tax_post_thumb' => 'Gallery tile image', 'slug' => __('Slug'), 'posts' => __('Image count')); return $new_columns; } add_filter("manage_phototype_custom_column", 'manage_taxonomy_columns', 10, 3); function manage_taxonomy_columns($content, $column_name, $term_id) { $term = get_term($term_id, 'phototype'); switch ($column_name) { case 'triangle_tax_post_thumb': $data = get_tax_meta($term_id, 'image_field_id', true); $attachID = $data['id']; $imgurl = wp_get_attachment_image_src($attachID);
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(); }
$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 function lead_meta_box() { add_meta_box('postexcerpt', 'Subtitulo', 'post_excerpt_meta_box', 'proposta', 'normal', 'core'); } add_action('admin_menu', 'lead_meta_box'); // Renomeia FEATURED IMAGE para ICONE add_action('do_meta_boxes', 'change_image_box'); function change_image_box() { add_meta_box('postimagediv', __('Ícone (16x16px)'), 'post_thumbnail_meta_box', 'proposta', 'normal', 'high'); } function category_custom_html()
<?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(); }
<?php require_once 'Tax-meta-class.php'; if (is_admin()) { $prefix = 'cb_'; $config = array('id' => 'cb_cat_meta', 'title' => 'Category Extra Meta', 'pages' => array('category'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => true); $cb_cat_meta = new Tax_Meta_Class($config); $cb_cat_meta->addSelect($prefix . 'cat_style_field_id', array('1' => 'One post per line', '2' => 'Two posts per line', '3' => 'Three posts per line'), array('name' => __('Post Layout ', 'tax-meta'), 'std' => array('2'))); $cb_cat_meta->addSelect($prefix . 'cat_infinite', array('off' => 'Number Pagination', 'infinite-scroll' => 'Infinite Scroll', 'infinite-load' => 'Infinite Scroll With Load More Button'), array('name' => __('Pagination Style', 'tax-meta'), 'std' => array('Number Pagination'))); $cb_cat_meta->addImage($prefix . 'bg_image_field_id', array('name' => __('Category Cover Image ', 'tax-meta'))); $cb_cat_meta->addWysiwyg($prefix . 'cat_ad', array('name' => __('Category Ad', 'tax-meta'))); $cb_cat_meta->Finish(); $config = array('id' => 'cb_tag_meta', 'title' => 'Tags Extra Meta', 'pages' => array('post_tag'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => true); $cb_tag_meta = new Tax_Meta_Class($config); $cb_tag_meta->addSelect($prefix . 'cat_infinite', array('off' => 'Number Pagination', 'infinite-scroll' => 'Infinite Scroll', 'infinite-load' => 'Infinite Scroll With Load More Button'), array('name' => __('Pagination Style', 'tax-meta'), 'std' => array('Number Pagination'))); $cb_tag_meta->addImage($prefix . 'bg_image_field_id', array('name' => __('Tag Cover Image ', 'tax-meta'))); $cb_tag_meta->addWysiwyg($prefix . 'cat_ad', array('name' => __('Advertisement', 'tax-meta'))); $cb_tag_meta->Finish(); }
<?php require_once "Tax-meta-class.php"; if (is_admin()) { $prefix = 'cb_'; $config = array('id' => 'cb_cat_meta', 'title' => 'Category Extra Meta', 'pages' => array('category'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false); $cb_cat_meta = new Tax_Meta_Class($config); $cb_cat_meta->addSelect($prefix . 'cat_style_field_id', array('style-a' => 'Blog Style A', 'style-b' => 'Blog Style B', 'style-c' => 'Blog Style C', 'style-d' => 'Blog Style D'), array('name' => __('Blog Style ', 'tax-meta'), 'std' => array('style-a'))); $cb_cat_meta->addColor($prefix . 'color_field_id', array('name' => __('Category Global Color', 'tax-meta'))); $cb_cat_meta->addSelect($prefix . 'cat_featured_op', array('Off' => 'Off', 'full-slider' => 'Full-width Slider', 'slider' => 'Slider', 'grid-4' => 'Grid - 4', 'grid-5' => 'Grid - 5', 'grid-6' => 'Grid - 6'), array('name' => __('Show grid/slider ', 'tax-meta'), 'std' => array('Off'))); $cb_cat_meta->addSelect($prefix . 'cat_sidebar', array('off' => 'Off', 'on' => 'On'), array('name' => __('Custom Sidebar ', 'tax-meta'), 'std' => array('off'))); $cb_cat_meta->addImage($prefix . 'bg_image_field_id', array('name' => __('Category Background Image ', 'tax-meta'))); $cb_cat_meta->addSelect($prefix . 'bg_image_setting_op', array('1' => 'Full-Width Stretch', '2' => 'Repeat', '3' => 'No-Repeat'), array('name' => __('Background Image Settings', 'tax-meta'), 'std' => array('1'))); $cb_cat_meta->addColor($prefix . 'bg_color_field_id', array('name' => __('Category Background Color', 'tax-meta'))); $cb_cat_meta->Finish(); }
include 'classes/cpt_.php'; include 'classes/meta_.php'; include 'classes/tax_.php'; include 'classes/tax_meta_.php'; include 'ui.php'; include 'settings.php'; new bb_repost\cptClass('Repost', 'Reposts', array('taxonomies' => array('post_tag'))); $fields = array(array('title' => 'Source Article', 'field_name' => 'source_article'), array('title' => 'Source Excerpt', 'field_name' => 'source_excerpt', 'type' => 'textarea'), array('title' => 'Twitter', 'field_name' => 'twitter', 'type' => 'checkbox')); new bb_repost\metaClass('Reposts', array('repost'), $fields); new bb_repost\taxClass('Source Type', 'Source Types', array('repost')); $config = array('id' => 'sourcetype_meta_box', 'title' => 'Source Type Meta', 'pages' => array('sourcetype'), 'local_images' => true, 'use_with_theme' => false); $sourcetype_meta = new Tax_Meta_Class($config); $sourcetype_meta->addText('tagline', array('name' => 'Tag Line', 'desc' => 'Text to display at the bottom of each post')); $sourcetype_meta->addImage('avatar', array('name' => 'Post Avatar', 'desc' => 'Custom avatar for this type of post. If left blank will use author avatar.')); $sourcetype_meta->addImage('button_image', array('name' => 'Button Image', 'desc' => 'Custom button image for this type of post. If left blank will use plain HTML button.')); $sourcetype_meta->Finish(); add_action('wp_enqueue_scripts', 'bb_repost_frontend_scripts'); function bb_repost_frontend_scripts() { wp_enqueue_style('normalize', '/wp-content/plugins/bb-repost/css/normalize.css'); } add_action('init', 'bb_repost_add_default_source_types', 10); function bb_repost_add_default_source_types() { $inited = get_option('bb_repost_initialised'); if (!$inited) { $terms = array('We did this' => '', "We're listening to this" => 'Todays artist of the day is...', 'We read this' => '', 'We wrote this' => ''); foreach ($terms as $term => $description) { wp_insert_term($term, 'sourcetype', array('description' => $description)); } update_option('bb_repost_initialised', true);
function add_meta_field() { if (is_admin()) { $attr_list = $this->get_attributes(); $pages = array(); if (!empty($attr_list)) { foreach ($attr_list as $key => $value) { $pages[] = $key; } } /* * prefix of meta keys, optional */ $prefix = 'st_'; /* * configure your meta box */ $config = array('id' => 'st_extra_infomation', 'title' => __('Extra Information', ST_TEXTDOMAIN), 'pages' => $pages, 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false); if (!class_exists('Tax_Meta_Class')) { STFramework::write_log('Tax_Meta_Class not found in class.attribute.php line 121'); return; } /* * Initiate your meta box */ $my_meta = new Tax_Meta_Class($config); /* * Add fields to your meta box */ //select field $my_meta->addText($prefix . 'icon', array('name' => __('Icon', ST_TEXTDOMAIN), 'desc' => __('You can upload your font-icon file in the site by navigating to Traveler Settings -> Importer Fonticon', ST_TEXTDOMAIN))); //Image field //$my_meta->addImage($prefix.'image',array('name'=> __('Image ',ST_TEXTDOMAIN), // 'desc'=>__('If dont like the icon, you can use image instead',ST_TEXTDOMAIN))); //file upload field /* * Don't Forget to Close up the meta box decleration */ //Finish Meta Box Decleration $my_meta->Finish(); } }
*/ $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'))); $mango_meta->addSelect($prefix . 'taxonomy_banner_rev_slider', mango_get_rev_sliders(), array('name' => __('Banner Revolution Slider', 'mango'), 'desc' => __('Only useful when the banner type is Revolution Slider.', 'mango'))); //wysiwyg field $mango_meta->addWysiwyg($prefix . 'taxonomy_banner_custom', array('name' => __('Custom Banner', 'mango'), 'desc' => __("Add custom banner from this editor", 'mango'))); /* Don't Forget to Close up the meta box decleration */ //Finish Meta Box Decleration $mango_meta->Finish(); $mango_product_meta->Finish(); }
require_once get_template_directory() . '/framework/libs/tax-meta-class/Tax-meta-class.php'; if (is_admin()) { /* * prefix of meta keys, optional */ $prefix = 'thim_'; /* * configure your meta box */ $config = array('id' => 'category_meta_box', 'title' => 'Category Meta Box', 'pages' => array('category'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false); $my_meta = new Tax_Meta_Class($config); /* * Add fields to your meta box */ $my_meta->addSelect($prefix . 'layout', array('' => 'Using in Theme Option', 'full-content' => 'No Sidebar', 'sidebar-left' => 'Left Sidebar', 'sidebar-right' => 'Right Sidebar'), array('name' => __('Custom Layout ', 'mabu'), 'std' => array(''))); $my_meta->addSelect($prefix . 'custom_heading', array('' => 'Using in Theme Option', 'custom' => 'Custom'), array('name' => __('Custom Heading ', 'mabu'), 'std' => array(''))); $my_meta->addImage($prefix . 'archive_top_image', array('name' => __('Background images Heading', 'mabu'))); $my_meta->addColor($prefix . 'archive_cate_heading_bg_color', array('name' => __('Background Color Heading', 'mabu'))); $my_meta->addColor($prefix . 'archive_cate_heading_text_color', array('name' => __('Text Color Heading', 'mabu'))); $my_meta->addCheckbox($prefix . 'archive_cate_hide_title', array('name' => __('Hide Title', 'mabu'))); $my_meta->Finish(); /** * Custom Woocommerce Category Meta */ $thim_wc_config = array('id' => 'woocommerce_meta_box', 'title' => 'Product Meta Box', 'pages' => array('product_cat'), 'context' => 'normal', 'fields' => array(), 'local_images' => false, 'use_with_theme' => false); $thim_wc_meta = new Tax_Meta_Class($thim_wc_config); $thim_wc_meta->addCheckbox($prefix . 'category_show_related_products', array('name' => __('Hide Related ', 'mabu'), 'desc' => __('Hide related products in single product', 'mabu'))); $thim_wc_meta->addSelect($prefix . 'category_custom_columns', array('default' => 'Default', 1 => '1', 2 => '2', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9', 10 => '10'), array('name' => __('Custom columns', 'mabu'), 'std' => array('default'))); $thim_wc_meta->addtext($prefix . 'category_products_per_page', array('name' => __('Number of Products per Page', 'mabu'), 'std' => '')); $thim_wc_meta->Finish(); }
<?php add_post_type_support('bb_note', 'page-attributes'); function tax_bb_note_type() { $labels = array('name' => _x('Note Type', 'taxonomy general name'), 'singular_name' => _x('Note Type', 'taxonomy singular name'), 'search_items' => __('Search Note Types'), 'all_items' => __('All Note Types'), 'parent_item' => __('Parent Note Type'), 'parent_item_colon' => __('Parent Note Type:'), 'edit_item' => __('Edit Note Type'), 'update_item' => __('Update Note Type'), 'add_new_item' => __('Add New Note Type'), 'new_item_name' => __('New Note Type'), 'menu_name' => __('Note Types')); $args = array('labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_tagcloud' => true, 'show_in_nav_menus' => true, 'show_admin_column' => true, 'update_count_callback' => '_update_generic_term_count', 'query_var' => 'bb_note_type', 'rewrite' => array('slug' => 'bb_note_type')); register_taxonomy('bb_note_type', array('bb_note'), $args); } add_action('init', 'tax_bb_note_type', 0); add_action('admin_menu', 'bbconnect_register_note_types_page'); function bbconnect_register_note_types_page() { add_submenu_page('users.php', 'Note Types', 'Note Types', 'list_users', 'edit-tags.php?taxonomy=bb_note_type&post_type=bb_note'); } // Add tax meta $config = array('id' => 'note_type_meta_box', 'title' => 'Note Type Meta', 'pages' => array('bb_note_type'), 'local_images' => false); $tax_meta = new Tax_Meta_Class($config); $tax_meta->addCheckbox('initially_displayed', array('name' => 'Initially Displayed ', 'desc' => 'If ticked, notes of this type will be displayed by default when viewing a Contact\'s notes')); $tax_meta->Finish();
function start_el(&$output, $item, $depth = 0, $args = array(), $current_object_id = 0) { global $wp_query; $my_meta = new Tax_Meta_Class(''); $indent = $depth ? str_repeat("\t", $depth) : ''; if ($depth == 0) { if (empty($item->description)) { $class = ' single'; } else { $class = false; } } else { $class = false; } $class_names = $value = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item)); $class_names = ' class="' . esc_attr($class_names . $class) . '"'; $output .= $indent . '<li id="menu-item-' . $item->ID . '"' . $value . $class_names . '>'; $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : ''; $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : ''; $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : ''; $attributes .= !empty($item->url) ? ' href="' . esc_attr($item->url) . '"' : ''; //$attributes .= ' data-id="'. esc_attr( $item->object_id ) .'"'; //$attributes .= ' data-slug="'. esc_attr( basename(get_permalink($item->object_id )) ) .'"'; $item_output = $args->before; $item_output .= '<a' . $attributes . '>'; if ($depth == 0) { if (isset($item->classes[4]) && in_array("ot-dropdown", $item->classes)) { $item_output .= '<span>'; } } $item_output .= $args->link_before . apply_filters('the_title', $item->title, $item->ID) . $args->link_after; if ($depth == 0 && $item->description) { $item_output .= '<i>' . $item->description . '</i>'; } if ($depth == 0) { if (isset($item->classes[4]) && in_array("ot-dropdown", $item->classes)) { $item_output .= '</span>'; } } $item_output .= '</a>'; $item_output .= $args->after; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); $my_meta->Finish(); }
require_once "Tax-meta-class/Tax-meta-class.php"; global $current_user; get_currentuserinfo(); /* * configure taxonomy custom fields */ $configt = array('id' => 'categ_meta_box', 'title' => 'Category options', 'pages' => array('category'), 'context' => 'normal', 'fields' => array(), 'local_images' => true, 'use_with_theme' => true); /* * Initiate your taxonomy custom fields */ $custom_category = new Tax_Meta_Class($configt); /* * Add fields */ //Categories image $custom_category->addImage('categ_img', array('name' => __('Download an image for your category', 'iftheme'))); //Display children checkbox $custom_category->addCheckbox('categ_children', array('name' => __('Display sub-categories', 'iftheme'), 'desc' => __("Check this box if you want to display a list of child categories", 'iftheme'))); //Display children checkbox $check = true; if (isset($_GET['taxonomy']) && $_GET['taxonomy'] == 'category') { $check = isset($_GET['tag_ID']) ? get_tax_meta($_GET['tag_ID'], 'categ_posts') : true; } $custom_category->addCheckbox('categ_posts', array('name' => __('Display Posts', 'iftheme'), 'desc' => __("Check this box if you want to display a list of the category's posts", 'iftheme'), 'std' => $check)); //hidden field //to avoid conflict with wpml plugin //global $current_user; get_currentuserinfo(); //$custom_category->addHidden('cur_user',array('name'=> 'current user', 'std'=>$current_user->ID)); //$custom_category->addText('cur_user',array('name'=> 'current user', 'std'=>$current_user->ID)); $custom_category->Finish();
Description: Adding keywords field for tag and category taxonomies. Rewrite title-tag. Output META description and META keywords to HEAD. Version: 0.4 Author: Your mom License: Free */ /** * Дополнительные поля keywords, description, title для tag и category */ require_once "Tax-meta-class/Tax-meta-class.php"; if (is_admin()) { $kdesc_config = array('id' => 'kdesc_keywords_meta_box', 'title' => 'Add Keywords', 'pages' => array('category', 'post_tag'), 'context' => 'normal', 'fields' => array(), 'use_with_theme' => false); $kdesc_field = new Tax_Meta_Class($kdesc_config); $kdesc_field->addText('m_kdesc_keywords', array('name' => __('Meta Keywords', 'tax-meta'), 'desc' => 'Custom keywords for this taxonomy.')); $kdesc_field->addText('m_kdesc_description', array('name' => __('Meta Description', 'tax-meta'), 'desc' => 'Custom description for this taxonomy.')); $kdesc_field->addText('m_kdesc_title', array('name' => __('Custom title', 'tax-meta'), 'desc' => 'Rewrite title-tag.')); $kdesc_field->Finish(); } /** * Вывод keywords и description */ function kdesc_add_meta($name, $content) { if ($content) { echo '<meta name="' . $name . '" itemprop="' . $name . '" content="' . $content . '">'; } } add_action('wp_head_add_meta', 'kdesc_add_meta', 10, 2); add_action('wp_head', function () { if (is_tag()) { $tax_id = get_query_var('tag_id'); }
register_sidebar(array('name' => __('Ideas Sidebar', 'opengov'), 'id' => 'sidebar-ideas', 'description' => __('Widgets in this area will be shown on single ideas only.', 'opengov'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>')); register_sidebar(array('name' => __('Archives Sidebar', 'opengov'), 'id' => 'sidebar-archives', 'description' => __('Widgets in this area will be shown on archived pagesonly.', 'opengov'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>')); register_sidebar(array('name' => __('Footer Left Sidebar', 'opengov'), 'id' => 'footer-left', 'description' => __('Footer Left area', 'opengov'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>')); register_sidebar(array('name' => __('Footer Center Sidebar', 'opengov'), 'id' => 'footer-center', 'description' => __('Footer Center area', 'opengov'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>')); register_sidebar(array('name' => __('Footer Right Sidebar', 'opengov'), 'id' => 'footer-right', 'description' => __('Footer Right area', 'opengov'), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>')); register_sidebar(array('name' => __('Footer Credits Text', 'opengov'), 'id' => 'footer-credits', 'description' => __('Please use only a TEXT HTML widget!', 'opengov'), 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '')); } require_once "lib/Tax-meta-class/Tax-meta-class.php"; if (is_admin()) { //examples: https://github.com/bainternet/Tax-Meta-Class/blob/master/class-usage-demo.php $config = array('id' => 'opengov_meta_box', 'title' => 'OpenGov Meta Box', 'pages' => array('idea_cat'), 'context' => 'normal', 'fields' => array(), 'local_images' => true, 'use_with_theme' => true); $opengov_cat_meta = new Tax_Meta_Class($config); $opengov_cat_meta->addCheckbox('opengov_is_active', array('name' => __('Is Active Call', 'tax-meta'))); $opengov_cat_meta->addDate('opengov_close_date', array('name' => __('Open Until', 'tax-meta'))); $opengov_cat_meta->addWysiwyg('opengov_short_descr', array('name' => __('Short Description', 'tax-meta'))); $opengov_cat_meta->Finish(); } function insert_attachment($file_handler, $post_id, $meta_name) { if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) { __return_false(); } require_once ABSPATH . "wp-admin" . '/includes/image.php'; require_once ABSPATH . "wp-admin" . '/includes/file.php'; require_once ABSPATH . "wp-admin" . '/includes/media.php'; $attach_id = media_handle_upload($file_handler, $post_id); $attach_url = wp_get_attachment_url($attach_id); update_post_meta($post_id, $meta_name, $attach_url); } require_once 'lib/wp_bootstrap_navwalker.php'; require_once 'lib/wp_bootstrap_comment.php';
function add_meta_field() { if (is_admin()) { $pages = array('st_cars_pickup_features'); /* * prefix of meta keys, optional */ $prefix = 'st_'; /* * configure your meta box */ $config = array('id' => 'st_extra_infomation_cars', 'title' => __('Extra Information', ST_TEXTDOMAIN), 'pages' => $pages, 'context' => 'normal', 'fields' => array(), 'local_images' => FALSE, 'use_with_theme' => FALSE); if (!class_exists('Tax_Meta_Class')) { STFramework::write_log('Tax_Meta_Class not found in class.attribute.php line 121'); return; } /* * Initiate your meta box */ $my_meta = new Tax_Meta_Class($config); /* * Add fields to your meta box */ //text field $my_meta->addText($prefix . 'icon', array('name' => __('Icon', ST_TEXTDOMAIN), 'desc' => __('Example: <br>Input "fa-desktop" for <a href="http://fortawesome.github.io/Font-Awesome/icons/" target="_blank" >Fontawesome</a>,<br>Input "im-pool" for <a href="https://icomoon.io/" target="_blank">Icomoon</a> ', ST_TEXTDOMAIN))); //Image field //$my_meta->addImage($prefix.'image',array('name'=> __('Image ',ST_TEXTDOMAIN), // 'desc'=>__('If dont like the icon, you can use image instead',ST_TEXTDOMAIN))); //file upload field /* * Don't Forget to Close up the meta box decleration */ //Finish Meta Box Decleration $my_meta->Finish(); } }
//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); /* * Then just add the fields to the repeater block */ //repeater block $my_meta->addRepeaterBlock($prefix . 're_', array('inline' => true, 'name' => __('This is a Repeater Block', 'tax-meta'), 'fields' => $repeater_fields)); /* * Don't Forget to Close up the meta box decleration */ //Finish Meta Box Decleration $my_meta->Finish(); }
<?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();