WP Catalogue adding custom Taxonomy
-
Hi!
I need your help. So I am trying to customize WP Catalogue that will have a link(Taxonomy) on the bottom of each product that will link to the Merchant info. Once I click on merchant “URL” I should be able to see a list of all the product for the current merchant. So in a sense it should be working as a simple category listing.
you can see the demo site here: http://bekov.net/DEMO/wpcproduct/ball-chair/
So I added this code:
/** * Custom taxonomies * */ function add_custom_taxonomies() { // Add new "Locations" taxonomy to Posts register_taxonomy('merchant', 'wpcproduct', array( // Hierarchical taxonomy (like categories) 'hierarchical' => true, // This array of options controls the labels displayed in the WordPress Admin UI 'labels' => array( 'name' => _x( 'Merchant Information', 'taxonomy general name' ), 'singular_name' => _x( 'Merchant Info', 'taxonomy singular name' ), 'search_items' => __( 'Search Merchant' ), 'all_items' => __( 'All Merchant' ), 'parent_item' => __( 'Parent Merchant' ), 'parent_item_colon' => __( 'Parent Merchant:' ), 'edit_item' => __( 'Edit Merchant' ), 'update_item' => __( 'Update Merchant' ), 'add_new_item' => __( 'Add New Merchant' ), 'new_item_name' => __( 'New Merchant Name' ), 'menu_name' => __( '[Merchants]' ), ), // Control the slugs used for this taxonomy 'rewrite' => array( 'slug' => 'merchant', // This controls the base slug that will display before each term 'with_front' => false, // Don't display the category base before "/locations/" 'hierarchical' => true // This will allow URL's like "/locations/boston/cambridge/" ), )); } add_action( 'init', 'add_custom_taxonomies', 0 );
to the functions.php in the theme files.
And I added this code:
<h4>Merchant Info</h4> <!--MERCHANT INFO START--> <?php echo get_the_term_list( $post->ID, 'merchant', '', ', ', '</p>' );?> <!--MERCHANT INFO END -->
to the wp-catalogue/themefiles/single-wpcproduct.php
What did I do wrong
- The topic ‘WP Catalogue adding custom Taxonomy’ is closed to new replies.