Woocommerce分类

时间:2014-05-27 20:54:36

标签: wordpress woocommerce taxonomy

我为woocomerce产品定制分类,产品将书籍和ecery书有他自己的写作。

<pre>function custom_taxonomy_writter() {
    $labels = array(
        'name' => 'Writters',
        'singular_name' => 'Writter',
        'menu_name' => 'Writter',
        'all_items' => 'All writters',
        'parent_item' => 'Parent writter',
        'parent_item_colon' => 'Parent writter:',
        'new_item_name' => 'New writter name',
        'add_new_item' => 'Add new writter',
        'edit_item' => 'Edit writter',
        'update_item' => 'Update writter',
        'separate_items_with_commas' => 'Separate writter with commas',
        'search_items' => 'Search writters',
        'add_or_remove_items' => 'Add or remove writters',
        'choose_from_most_used' => 'Choose from the most used writters',
    );
    $args = array(
        'labels' => $labels,
        'hierarchical' => true,
        'public' => true,
        'show_ui' => true,
        'show_admin_column' => true,
        'show_in_nav_menus' => true,
        'show_tagcloud' => true,
    );
    register_taxonomy('writter', 'product', $args);
}

add_action('init', 'custom_taxonomy_writter', 0);</pre>


来自wp admin的截屏:

enter image description here



现在我需要在产品标题下显示它,并且需要bi链接,如标签或类别。

enter image description here

1 个答案:

答案 0 :(得分:0)

Wooola!

<?php echo get_the_term_list( $post->ID, 'writter', '', ', ' ); ?>

简单而有效!!!并且还与作者列出了他的书籍:)