0
votes

i made custom taxonomy for woocomerce products, products will be books and ecery book have his own writter.

<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>


Screenshoot from wp admin:

enter image description here



Now I need to display it for example under the product title, and needs to bi link, like tags or categories.

enter image description here

1
FYI: Assuming your target audience speaks English, it's spelt "writer", not "writter".bacar

1 Answers

0
votes

Wooola!

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

Simple and works!!! And is also linked to author with listing of his books :)