• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP get_taxonomies函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中get_taxonomies函数的典型用法代码示例。如果您正苦于以下问题:PHP get_taxonomies函数的具体用法?PHP get_taxonomies怎么用?PHP get_taxonomies使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_taxonomies函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: prepare_items

 function prepare_items()
 {
     $all_categories = array();
     $taxonomies = get_taxonomies($args = array('public' => true, '_builtin' => false));
     $taxonomies['category'] = 'category';
     $all_terms = get_terms($taxonomies, 'orderby=count&hide_empty=0&order=DESC');
     $totalitems = count($all_terms);
     $perpage = 100;
     $paged = !empty($_GET["paged"]) ? sanitize_text_field($_GET["paged"]) : '';
     if (empty($paged) || !is_numeric($paged) || $paged <= 0) {
         $paged = 1;
     }
     $totalpages = ceil($totalitems / $perpage);
     $offset = 0;
     if (!empty($paged) && !empty($perpage)) {
         $offset = ($paged - 1) * $perpage;
     }
     for ($i = $offset; $i < (int) $offset + (int) $perpage && !empty($all_terms[$i]); $i++) {
         $all_categories[] = $all_terms[$i];
     }
     $this->set_pagination_args(array("total_items" => $totalitems, "total_pages" => $totalpages, "per_page" => $perpage));
     $columns = $this->get_columns();
     $hidden = array();
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->items = $all_categories;
 }
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:27,代码来源:class.swpm-category-list.php


示例2: post_types

	function post_types($categoryId=false){

		$ret='';
		/*получаем все пользовательские типы записей*/
        $post_types=get_post_types(array(
			'public' => true,
			'_builtin' => false,
		), 'objects'); 
		foreach ($post_types as $post_type) {
		  $ret .= '<strong>'. $post_type->labels->singular_name. '</strong>';
		  $ret .= '<p class="news-yandex-ru-description">выберите рубрики посты из которых выводить в rss для яндекса. У выбранной рубрики в фид также будут включены все записи дочерних ей рубрик.</p>';
		  $ret .= '<p>';
		  /*получаем все иерархические taxonomies для типа записи*/
		  $taxonomies=get_taxonomies(array(
			'hierarchical' => true,
		    'public' => true,
			'_builtin' => false,
			'object_type' => array($post_type->name),
		  ), 'objects');
		  foreach ($taxonomies as $taxonomy) {
		    $ret .= $this->taxonomies(0, $taxonomy->name, $post_type->name);
		  }
		  $ret .= '</p>';
		}
    	return $ret;
		
    }
开发者ID:Alexander-smirnov,项目名称:infomist,代码行数:27,代码来源:news-yandex-ru.php


示例3: getPicklistOptions

 /**
  *
  * @return array;
  */
 public function getPicklistOptions()
 {
     $tax_args = array('public' => true, '_builtin' => false);
     $taxonomies = get_taxonomies($tax_args);
     $taxonomies[] = 'category';
     $args = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC', 'hide_empty' => 1, 'hierarchical' => 1, 'taxonomy' => $taxonomies, 'pad_counts' => true);
     $categories = get_categories($args);
     $children = array();
     if ($categories) {
         foreach ($categories as $v) {
             $v->title = $v->cat_name;
             $v->parent_id = $v->category_parent;
             $v->id = $v->cat_ID;
             $pt = $v->category_parent;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
     }
     //treecurse function from functions.php
     $list = treerecurse($children);
     $mitems = array();
     foreach ($list as $item) {
         $mitems[$item->id] = $item->treename;
     }
     return $mitems;
 }
开发者ID:TeamCodeStudio,项目名称:fpmoz,代码行数:31,代码来源:CategoryPopulator.php


示例4: filter_content

 public function filter_content($content)
 {
     // Get Templates
     $templates = self::get_option('rwp_templates');
     $terms = wp_get_object_terms(get_the_ID(), array_keys(get_taxonomies()));
     $terms_keys = array();
     foreach ($terms as $term) {
         $terms_keys[$term->taxonomy][] = $term->term_id;
     }
     //self::pretty_print( $terms_keys );
     foreach ($templates as $template) {
         if (isset($template['template_auto_reviews']) && !empty($template['template_auto_reviews'])) {
             if (is_singular($template['template_auto_reviews']) && is_main_query()) {
                 if (isset($template['template_exclude_terms'])) {
                     $to_exclude = false;
                     foreach ($template['template_exclude_terms'] as $id) {
                         $i = explode('-', $id);
                         if (in_array($i[1], $terms_keys[$i[0]])) {
                             $to_exclude = true;
                             break;
                         }
                     }
                     if ($to_exclude) {
                         continue;
                     }
                 }
                 $new_content = '[rwp-review id="-1" template="' . $template['template_id'] . '"]';
                 $content .= $new_content;
             }
         }
     }
     return $content;
 }
开发者ID:jprdev,项目名称:S.J-Enterprise,代码行数:33,代码来源:class-reviewer.php


示例5: getTaxonomies

 protected function getTaxonomies($args = [])
 {
     $defaults = ['show_ui' => true];
     $args = wp_parse_args($args, $defaults);
     $taxonomies = get_taxonomies(apply_filters('g5_assignments_get_taxonomies_args', $args), 'object');
     return $taxonomies;
 }
开发者ID:nmsde,项目名称:gantry5,代码行数:7,代码来源:AssignmentsTaxonomy.php


示例6: get_all_taxonomies

 /**
  * Get a definitive set of all taxonomies recognized by Types.
  *
  * Respects if some builtin taxonomy is overridden by Types.
  *
  * @return array
  * @since 1.9
  */
 public static function get_all_taxonomies()
 {
     // todo add simple caching
     $taxonomies = array();
     // Read Types taxonomies first.
     $types_taxonomies = get_option(WPCF_OPTION_NAME_CUSTOM_TAXONOMIES, array());
     if (is_array($types_taxonomies)) {
         foreach ($types_taxonomies as $slug => $data) {
             $taxonomies[$slug] = $data;
         }
     }
     // Get all taxonomies and add them to the set, but avoid overwriting Types taxonomies
     $all_taxonomies = self::object_to_array_deep(get_taxonomies(array('public' => true), 'objects'));
     foreach ($all_taxonomies as $slug => $data) {
         // check if taxonomies are already saved as custom taxonomies
         if (isset($taxonomies[$slug])) {
             continue;
         }
         if (!isset($data['slug'])) {
             $data['slug'] = $slug;
         }
         $taxonomies[$slug] = $data;
     }
     return $taxonomies;
 }
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:33,代码来源:utils.php


示例7: column

 public function column()
 {
     global $wp_version;
     $is_wp_v3_1 = version_compare($wp_version, '3.0.999', '>');
     add_filter('manage_media_columns', array($this, 'add'));
     add_action('manage_media_custom_column', array($this, 'value'), 10, 2);
     add_filter('manage_link-manager_columns', array($this, 'add'));
     add_action('manage_link_custom_column', array($this, 'value'), 10, 2);
     add_action('manage_edit-link-categories_columns', array($this, 'add'));
     add_filter('manage_link_categories_custom_column', array($this, 'returnvalue'), 10, 3);
     foreach (get_taxonomies() as $taxonomy) {
         add_action("manage_edit-{$taxonomy}_columns", array($this, 'add'));
         add_filter("manage_{$taxonomy}_custom_column", array($this, 'returnvalue'), 10, 3);
         if ($is_wp_v3_1) {
             add_filter("manage_edit-{$taxonomy}_sortable_columns", array($this, 'add'));
         }
     }
     foreach (get_post_types() as $post_type) {
         add_action("manage_edit-{$post_type}_columns", array($this, 'add'));
         add_filter("manage_{$post_type}_posts_custom_column", array($this, 'value'), 10, 3);
         if ($is_wp_v3_1) {
             add_filter("manage_edit-{$post_type}_sortable_columns", array($this, 'add'));
         }
     }
     add_action('manage_users_columns', array($this, 'add'));
     add_filter('manage_users_custom_column', array($this, 'returnvalue'), 10, 3);
     if ($is_wp_v3_1) {
         add_filter("manage_users_sortable_columns", array($this, 'add'));
     }
     add_action('manage_edit-comments_columns', array($this, 'add'));
     add_action('manage_comments_custom_column', array($this, 'value'), 10, 2);
     if ($is_wp_v3_1) {
         add_filter("manage_edit-comments_sortable_columns", array($this, 'add'));
     }
 }
开发者ID:RA2WP,项目名称:RA2WP,代码行数:35,代码来源:class.attachaway_column.php


示例8: wptouch_register_theme_custom_post_types

function wptouch_register_theme_custom_post_types()
{
    if (wptouch_is_mobile_theme_showing()) {
        $settings = foundation_get_settings();
        $post_types_to_preserve = get_option('wptouch_custom_post_types');
        $post_types_to_register = array();
        $registered_types = wptouch_custom_posts_get_list(true);
        if (is_array($post_types_to_preserve) && count($post_types_to_preserve) > 0) {
            foreach ($post_types_to_preserve as $type => $object) {
                if (!is_object($object)) {
                    $object = maybe_unserialize(urldecode($object));
                }
                if (!in_array($type, $registered_types)) {
                    $args = array('labels' => array('name' => $object->labels->name, 'singular_name' => $object->labels->singular_name), 'taxonomies' => $object->taxonomies, 'hierarchical' => $object->hierarchical, 'public' => $object->public, 'has_archive' => $object->has_archive, 'exclude_from_search' => $object->exclude_from_search, 'publicly_queryable' => $object->publicly_queryable, 'rewrite' => $object->rewrite, 'query_var' => $object->query_var);
                    register_post_type($type, $args);
                }
            }
        }
        $taxonomies_to_preserve = get_option('wptouch_custom_taxonomies');
        $taxonomies_to_register = array();
        $args = array('public' => true);
        $output = 'names';
        $registered_taxonomies = get_taxonomies($args, $output);
        if (is_array($taxonomies_to_preserve)) {
            foreach ($taxonomies_to_preserve as $taxonomy => $object) {
                if (!in_array($taxonomy, $registered_taxonomies)) {
                    $args = array('hierarchical' => $object->hierarchical, 'query_var' => $object->query_var, 'rewrite' => $object->rewrite);
                    register_taxonomy($taxonomy, $object->object_type, $args);
                }
            }
        }
    }
}
开发者ID:sumwander,项目名称:unyil,代码行数:33,代码来源:custom-posts.php


示例9: display_field

 public function display_field($field, $group_index = 1, $field_index = 1)
 {
     global $mf_domain;
     // If is not required this field be added a None value
     $notype = "";
     if (!$field['required_field']) {
         $notype = !empty($field['options']['notype']) ? $field['options']['notype'] : __("-- None --", $mf_domain);
     }
     $output = '';
     // Get the taxonomie as dropdownoption
     $select = array();
     $tax = get_taxonomies();
     foreach ($tax as $k => $v) {
         $select[] = $v;
     }
     $option_from_term_array = $field['options']['term'];
     $options = get_terms($select[$option_from_term_array], array('hide_empty' => false));
     $output = '<div class="mf-dropdown-box">';
     $value = $field['input_value'];
     $output .= sprintf('<select class="dropdown_mf" id="%s" name="%s" >', $field['input_id'], $field['input_name']);
     if ($notype != "") {
         $output .= "<option value=''>{$notype}</option>";
     }
     foreach ($options as $option) {
         $check = $option->slug == $value ? 'selected="selected"' : '';
         $output .= sprintf('<option value="%s" %s >%s</option>', esc_attr($option->slug), $check, esc_attr($option->name));
     }
     $output .= '</select>';
     $output .= '</div>';
     return $output;
 }
开发者ID:GafaMX,项目名称:dev_funciones_basicas,代码行数:31,代码来源:term_field.php


示例10: easy_wp_pagenavigation_set_posts_per_page

 function easy_wp_pagenavigation_set_posts_per_page($query)
 {
     if (is_admin()) {
         return;
     }
     $options = get_option(EWPN_ST);
     // Get taxonomies custom posts per page
     $args = array('public' => true, 'show_ui' => true);
     $taxonomies = get_taxonomies($args);
     if (!empty($taxonomies)) {
         foreach ($taxonomies as $key => $val) {
             if (isset($options[$key]) && !empty($options[$key]) && is_numeric($options[$key])) {
                 if ($key == 'category') {
                     if (is_category() && $query->is_main_query()) {
                         $query->set('posts_per_page', $options[$key]);
                     }
                 } elseif ($key == 'post_tag') {
                     if (is_tag() && $query->is_main_query()) {
                         $query->set('posts_per_page', $options[$key]);
                     }
                 } else {
                     if (is_tax($key) && $query->is_main_query()) {
                         $query->set('posts_per_page', $options[$key]);
                     }
                 }
             }
         }
     }
 }
开发者ID:phanhoanglong2610,项目名称:anc_gvn,代码行数:29,代码来源:functions.php


示例11: initialize

 /**
  * Initialization function, similar to __construct()
  *
  * @since 0.1
  */
 public static function initialize()
 {
     self::$wp_4dot0_plus = version_compare(get_bloginfo('version'), '4.0', '>=');
     /*
      * Set up the Media/Assistant submenu table column definitions
      */
     $taxonomies = get_taxonomies(array('show_ui' => true), 'names');
     foreach ($taxonomies as $tax_name) {
         if (MLACore::mla_taxonomy_support($tax_name)) {
             $tax_object = get_taxonomy($tax_name);
             self::$default_columns['t_' . $tax_name] = esc_html($tax_object->labels->name);
             self::$default_hidden_columns[] = 't_' . $tax_name;
             // self::$default_sortable_columns [] = none at this time
         }
         // supported taxonomy
     }
     // foreach $tax_name
     /*
      * For WP 4.3+ icon will be merged with the first visible preferred column
      */
     if (MLATest::$wp_4dot3_plus) {
         unset(self::$default_columns['icon']);
     }
     self::$default_columns = array_merge(self::$default_columns, MLACore::mla_custom_field_support('default_columns'));
     self::$default_hidden_columns = array_merge(self::$default_hidden_columns, MLACore::mla_custom_field_support('default_hidden_columns'));
     self::$default_sortable_columns = array_merge(self::$default_sortable_columns, MLACore::mla_custom_field_support('default_sortable_columns'));
 }
开发者ID:axeljohansson1988,项目名称:oddcv,代码行数:32,代码来源:class-mla-data-query.php


示例12: mla_admin_init_action

 /**
  * Adds Custom Field support to the Edit Media screen.
  * Declared public because it is an action.
  *
  * @since 0.80
  *
  * @return	void	echoes the HTML markup for the label and value
  */
 public static function mla_admin_init_action()
 {
     static $mc_att_category_metabox = array();
     /*
      * Enable the enhanced "Media Categories" searchable metaboxes for hiearchical taxonomies
      */
     if (class_exists('Media_Categories') && ('checked' == MLAOptions::mla_get_option(MLAOptions::MLA_MEDIA_MODAL_DETAILS_CATEGORY_METABOX) || 'checked' == MLAOptions::mla_get_option(MLAOptions::MLA_MEDIA_MODAL_DETAILS_TAG_METABOX))) {
         $taxonomies = get_taxonomies(array('show_ui' => true), 'objects');
         foreach ($taxonomies as $key => $value) {
             if (MLAOptions::mla_taxonomy_support($key)) {
                 if ($value->hierarchical) {
                     if ('checked' == MLAOptions::mla_get_option(MLAOptions::MLA_MEDIA_MODAL_DETAILS_CATEGORY_METABOX)) {
                         $mc_att_category_metabox[] = new Media_Categories($key);
                     }
                 } else {
                     if ('checked' == MLAOptions::mla_get_option(MLAOptions::MLA_MEDIA_MODAL_DETAILS_TAG_METABOX)) {
                         $mc_att_category_metabox[] = new Media_Categories($key);
                     }
                 }
                 // flat
             }
             // is supported
         }
         // foreach
     }
     // class_exists
     add_post_type_support('attachment', 'custom-fields');
 }
开发者ID:rongandat,项目名称:best-picture,代码行数:36,代码来源:class-mla-edit-media.php


示例13: sandwich_tag_cloud_widget_shortcode

function sandwich_tag_cloud_widget_shortcode($attr, $content)
{
    $default = '';
    foreach (get_taxonomies() as $taxonomy) {
        $tax = get_taxonomy($taxonomy);
        if (!$tax->show_tagcloud || empty($tax->labels->name)) {
            continue;
        }
        $default = esc_attr($taxonomy);
        break;
    }
    $attr = wp_parse_args($attr, array('title' => __('Tag Cloud', 'pbsandwich'), 'taxonomy' => $default, 'hide_title' => false));
    $hideTitleClass = '';
    if ($attr['hide_title']) {
        $hideTitleClass = 'hide_title';
    }
    ob_start();
    ?>
	<div class="sandwich <?php 
    echo $hideTitleClass;
    ?>
">
		<?php 
    the_widget('WP_Widget_Tag_Cloud', $attr);
    ?>
	</div>
	
	<?php 
    return ob_get_clean();
}
开发者ID:bruno-barros,项目名称:w.eloquent.light,代码行数:30,代码来源:widget-tag-cloud.php


示例14: taxonomy_slug_rewrite

function taxonomy_slug_rewrite($wp_rewrite)
{
    $rules = array();
    // get all custom taxonomies
    $taxonomies = get_taxonomies(array('_builtin' => false), 'objects');
    // get all custom post types
    $post_types = get_post_types(array('public' => true, '_builtin' => false), 'objects');
    foreach ($post_types as $post_type) {
        foreach ($taxonomies as $taxonomy) {
            // go through all post types which this taxonomy is assigned to
            foreach ($taxonomy->object_type as $object_type) {
                // check if taxonomy is registered for this custom type
                if ($object_type == $post_type->rewrite['slug']) {
                    // get category objects
                    $terms = get_categories(array('type' => $object_type, 'taxonomy' => $taxonomy->name, 'hide_empty' => 0));
                    // make rules
                    foreach ($terms as $term) {
                        $rules[$object_type . '/' . $term->slug . '/?$'] = 'index.php?' . $term->taxonomy . '=' . $term->slug;
                    }
                }
            }
        }
    }
    // merge with global rules
    $wp_rewrite->rules = $rules + $wp_rewrite->rules;
}
开发者ID:angelmoskera,项目名称:sa-photo-gallery,代码行数:26,代码来源:sa-photo-gallery.php


示例15: parse_request

 public function parse_request($qty, $request = array())
 {
     if (is_null($qty)) {
         $qty = Utils::instance()->get_qty_from_range(Variable::super(INPUT_POST, array(Plugin::$slug, 'qty'), FILTER_UNSAFE_RAW));
     }
     if (0 === $qty) {
         return esc_attr__('Zero is not a good number of terms to fake...', 'fakerpress');
     }
     $name_size = Variable::super(INPUT_POST, array(Plugin::$slug, 'size'), FILTER_UNSAFE_RAW);
     // Fetch taxomies
     $taxonomies = Variable::super($request, array('taxonomies'), FILTER_SANITIZE_STRING);
     $taxonomies = array_map('trim', explode(',', $taxonomies));
     $taxonomies = array_intersect(get_taxonomies(array('public' => true)), $taxonomies);
     // Only has meta after 4.4-beta
     $has_metas = version_compare($GLOBALS['wp_version'], '4.4-beta', '>=');
     if ($has_metas) {
         $metas = Variable::super($request, array('meta'), FILTER_UNSAFE_RAW);
     }
     for ($i = 0; $i < $qty; $i++) {
         $this->set('taxonomy', $taxonomies);
         $this->set('name', $name_size);
         $this->set('description');
         $this->set('parent_term');
         $term_id = $this->generate()->save();
         if ($has_metas && $term_id && is_numeric($term_id)) {
             foreach ($metas as $meta_index => $meta) {
                 Meta::instance()->object($term_id, 'term')->generate($meta['type'], $meta['name'], $meta)->save();
             }
         }
         $results[] = $term_id;
     }
     $results = array_filter((array) $results, 'absint');
     return $results;
 }
开发者ID:luancuba,项目名称:fakerpress,代码行数:34,代码来源:term.php


示例16: wp_dropdown_taxonomies

 function wp_dropdown_taxonomies($args = '')
 {
     $defaults = array('selected' => 0, 'echo' => 1, 'name' => 'taxonomy', 'id' => '', 'class' => '', 'show_option_none' => '', 'show_option_no_change' => '', 'option_none_value' => '');
     $r = wp_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     $taxonomies = get_taxonomies(array('public' => true, 'show_ui' => true), 'objects');
     $output = '';
     // Back-compat with old system where both id and name were based on $name argument
     if (empty($id)) {
         $id = $name;
     }
     if (!empty($taxonomies)) {
         $output = "<select name='" . esc_attr($name) . "' id='" . esc_attr($id) . "' class='" . esc_attr($class) . "'>\n";
         if ($show_option_no_change) {
             $output .= "\t<option value=\"-1\">{$show_option_no_change}</option>";
         }
         if ($show_option_none) {
             $output .= "\t<option value=\"" . esc_attr($option_none_value) . "\">{$show_option_none}</option>\n";
         }
         foreach ($taxonomies as $tax_name => $taxonomy) {
             $output .= sprintf("\t" . '<option value="%s" %s>%s</option>' . "\n", esc_attr($tax_name), selected($r['selected'], $tax_name, false), $taxonomy->label);
         }
         $output .= "</select>\n";
     }
     $output = apply_filters('wp_dropdown_taxonomies', $output);
     if ($echo) {
         echo $output;
     }
     return $output;
 }
开发者ID:kubens,项目名称:Snippets,代码行数:30,代码来源:wp_dropdown_taxonomies.php


示例17: _build_taxonomies

 /**
  * Registers Attachment Categories and Attachment Tags custom taxonomies, adds taxonomy-related filters
  *
  * @since 0.1
  *
  * @return	void
  */
 private static function _build_taxonomies()
 {
     if (MLAOptions::mla_taxonomy_support('attachment_category')) {
         $labels = array('name' => _x('Att. Categories', 'taxonomy general name'), 'singular_name' => _x('Att. Category', 'taxonomy singular name'), 'search_items' => __('Search Att. Categories'), 'all_items' => __('All Att. Categories'), 'parent_item' => __('Parent Att. Category'), 'parent_item_colon' => __('Parent Att. Category:'), 'edit_item' => __('Edit Att. Category'), 'update_item' => __('Update Att. Category'), 'add_new_item' => __('Add New Att. Category'), 'new_item_name' => __('New Att. Category Name'), 'menu_name' => __('Att. Category'));
         register_taxonomy('attachment_category', array('attachment'), array('hierarchical' => true, 'labels' => $labels, 'show_ui' => true, 'query_var' => true, 'rewrite' => true));
     }
     if (MLAOptions::mla_taxonomy_support('attachment_tag')) {
         $labels = array('name' => _x('Att. Tags', 'taxonomy general name'), 'singular_name' => _x('Att. Tag', 'taxonomy singular name'), 'search_items' => __('Search Att. Tags'), 'all_items' => __('All Att. Tags'), 'parent_item' => __('Parent Att. Tag'), 'parent_item_colon' => __('Parent Att. Tag:'), 'edit_item' => __('Edit Att. Tag'), 'update_item' => __('Update Att. Tag'), 'add_new_item' => __('Add New Att. Tag'), 'new_item_name' => __('New Att. Tag Name'), 'menu_name' => __('Att. Tag'));
         register_taxonomy('attachment_tag', array('attachment'), array('hierarchical' => false, 'labels' => $labels, 'show_ui' => true, 'update_count_callback' => '_update_post_term_count', 'query_var' => true, 'rewrite' => true));
     }
     $taxonomies = get_taxonomies(array('show_ui' => true), 'names');
     foreach ($taxonomies as $tax_name) {
         if (MLAOptions::mla_taxonomy_support($tax_name)) {
             register_taxonomy_for_object_type($tax_name, 'attachment');
             if ('checked' == MLAOptions::mla_get_option('attachments_column')) {
                 add_filter("manage_edit-{$tax_name}_columns", 'MLAObjects::mla_taxonomy_get_columns_filter', 10, 1);
                 // $columns
                 add_filter("manage_{$tax_name}_custom_column", 'MLAObjects::mla_taxonomy_column_filter', 10, 3);
                 // $place_holder, $column_name, $tag->term_id
             }
             // option is checked
         }
         // taxonomy support
     }
     // foreach
 }
开发者ID:rongandat,项目名称:best-picture,代码行数:33,代码来源:class-mla-objects.php


示例18: form

    /**
     * @param array $instance
     */
    public function form($instance)
    {
        $current_taxonomy = $this->_get_current_taxonomy($instance);
        $title_id = $this->get_field_id('title');
        $instance['title'] = !empty($instance['title']) ? esc_attr($instance['title']) : '';
        echo '<p><label for="' . $title_id . '">' . __('Title:') . '</label>
			<input type="text" class="widefat" id="' . $title_id . '" name="' . $this->get_field_name('title') . '" value="' . $instance['title'] . '" />
		</p>';
        $taxonomies = get_taxonomies(array('show_tagcloud' => true), 'object');
        $id = $this->get_field_id('taxonomy');
        $name = $this->get_field_name('taxonomy');
        $input = '<input type="hidden" id="' . $id . '" name="' . $name . '" value="%s" />';
        switch (count($taxonomies)) {
            // No tag cloud supporting taxonomies found, display error message
            case 0:
                echo '<p>' . __('The tag cloud will not be displayed since their are no taxonomies that support the tag cloud widget.') . '</p>';
                printf($input, '');
                break;
                // Just a single tag cloud supporting taxonomy found, no need to display options
            // Just a single tag cloud supporting taxonomy found, no need to display options
            case 1:
                $keys = array_keys($taxonomies);
                $taxonomy = reset($keys);
                printf($input, esc_attr($taxonomy));
                break;
                // More than one tag cloud supporting taxonomy found, display options
            // More than one tag cloud supporting taxonomy found, display options
            default:
                printf('<p><label for="%1$s">%2$s</label>' . '<select class="widefat" id="%1$s" name="%3$s">', $id, __('Taxonomy:'), $name);
                foreach ($taxonomies as $taxonomy => $tax) {
                    printf('<option value="%s"%s>%s</option>', esc_attr($taxonomy), selected($taxonomy, $current_taxonomy, false), $tax->labels->name);
                }
                echo '</select></p>';
        }
    }
开发者ID:nmeiser,项目名称:WordPress,代码行数:38,代码来源:class-wp-widget-tag-cloud.php


示例19: tf_get_taxonomies

function tf_get_taxonomies()
{
    $args = array('hierarchical' => TRUE, 'public' => TRUE, 'show_ui' => TRUE, '_builtin' => FALSE);
    $args = apply_filters('tf_get_taxonomies', $args);
    $taxonomies = get_taxonomies($args);
    return $taxonomies;
}
开发者ID:shimion,项目名称:stlucks,代码行数:7,代码来源:SIDEBARS.php


示例20: getTaxonomyNames

 public static function getTaxonomyNames()
 {
     if (empty(static::$__taxonomyNames)) {
         static::$__taxonomyNames = get_taxonomies(null, 'names', 'and');
     }
     return static::$__taxonomyNames;
 }
开发者ID:kraftmark,项目名称:oowp,代码行数:7,代码来源:TaxonomyModel.php



注:本文中的get_taxonomies函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP get_taxonomies_by_object_type函数代码示例发布时间:2022-05-15
下一篇:
PHP get_tax_meta函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap