【问题标题】:Customizing the Native Tag Meta Box自定义原生标签元框
【发布时间】:2014-02-11 17:59:24
【问题描述】:

我添加了一个标签元框和分类法以允许在我的 CPT 上添加标签。但是我在法典中找不到编辑“用逗号分隔标签”和“从最常用的标签中选择”的参数。有谁知道这些的过滤器或 register_taxonomy 参数?

【问题讨论】:

    标签: php wordpress tags wordpress-theming


    【解决方案1】:

    我找到了get_taxonomy_labels 的参数列表,其中包含这些字段的正确参数。我能够将这些添加到我现有的 register_taxonomy() 函数的标签中。

    register_taxonomy( 'domain_tag', 
        array('domain_profiles'), /* if you change the name of register_post_type( 'domain_profiles', then you have to change this */
        array('hierarchical' => false,    /* if this is false, it acts like tags */
            'labels' => array(
                'name' => __( 'Related Domains', 'bonestheme' ), /* name of the custom taxonomy */
                'singular_name' => __( 'Domain', 'bonestheme' ), /* single taxonomy name */
                'search_items' =>  __( 'Search Domains', 'bonestheme' ), /* search title for taxomony */
                'all_items' => __( 'All Related Domains', 'bonestheme' ), /* all title for taxonomies */
                'parent_item' => __( 'Parent Domain', 'bonestheme' ), /* parent title for taxonomy */
                'parent_item_colon' => __( 'Parent Domain:', 'bonestheme' ), /* parent taxonomy title */
                'edit_item' => __( 'Edit Domain', 'bonestheme' ), /* edit Domain taxonomy title */
                'update_item' => __( 'Update Domain', 'bonestheme' ), /* update title for taxonomy */
                'add_new_item' => __( 'Add New Domain', 'bonestheme' ), /* add new title for taxonomy */
                'new_item_name' => __( 'New Domain Name', 'bonestheme' ), /* name title for taxonomy */
                // See get_taxonomy_labels for more arguments (below)
                'separate_items_with_commas' => __( 'Separate domains with commas', 'bonestheme' ),
                'choose_from_most_used' => __( 'Choose from the most used', 'bonestheme' ),
            ),
            'show_admin_column' => true,
            'show_ui' => true,
            'query_var' => true,
        )
    );
    

    【讨论】:

      猜你喜欢
      • 2014-12-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-22
      • 1970-01-01
      • 2012-01-22
      • 1970-01-01
      相关资源
      最近更新 更多