Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Friends I need help.

Am extending the Mayashop theme for a friend & I ran into a problem.

Created a custom post type named watchdog, created a taxonomy for it called watchdog-brand ... now the single-watchdog.php template is working just fine but I can't seem to find the appropriate template for the term itself listing all of the watchdog items under it.

Tried archive-watchdog.php , archive-watchdog-brand.php but no luck ... any idea?

I also found out that it doesn't even fallback to the archive.php .. just straight forward to the index.php file

& here is the code for the custom_post & the taxonomy

register_post_type(         
   TYPE_WATCHDOG,
   array(
     'description' => __('Watchdog', 'yiw'),
     'exclude_from_search' => false,
     'show_ui' => true,
     'labels' => yiw_label( apply_filters( 'yiw_watchdog_label_singular', __('Product', 'yiw') ), apply_filters( 'yiw_watchdog_label_plural', __('Products', 'yiw') ), __('Watchdog', 'yiw') ),
     'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),
     'public' => true,
     'capability_type' => 'post',
     'publicly_queryable' => true,
     'rewrite' => array( 'slug' => apply_filters( 'yiw_watchdog_rewrite', 'watchdog' ), 'with_front' => true )
   )
); 

flush_rewrite_rules();


register_taxonomy('watchdog-brand', array( TYPE_WATCHDOG ), array(
    'hierarchical' => true,
    'labels' => yiw_label_tax(__('Brand', 'yiw'), __('Brands', 'yiw')),
    'show_ui' => true, 
    'show_in_nav_menus' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'watchdog-brand', 'with_front' => false )
));
flush_rewrite_rules();

Thanks in advance

share|improve this question

2 Answers 2

Turned out to be an internal mayashop function in the taxonomy.php page that checks for two particular taxonomies if found populates their pages it not returns to the index.php

added my condition & all is well now, Thanks

<?php
/**
* @package WordPress
* @subpackage Impero
* @since Impero 1.0
*/                

 if ( yiw_is_portfolio_tax( get_query_var('taxonomy') ) )
 get_template_part( 'portfolio' );

else if ( get_query_var('taxonomy') == 'category-photo' )  
get_template_part( 'gallery' );

else if ( get_query_var('taxonomy') == 'watchdog-brand' )  
get_template_part( 'watchdog' );

else
get_template_part( 'index' );
share|improve this answer

Try taxonomy-watchdog-brand.php instead.

share|improve this answer
    
Tried it not working but I think I've laid my hands on the code that's been doing all of this hassle .. mayashop has included a taxonomy.php file that checks on two particular taxonomies otherwise gets the index page added a condition for my taxonomy & all is good now –  Zyad Sherif Mar 29 '13 at 9:04
    
The code provided should work though. The order in which the hierarchy executes is taxonomy-{taxonomy}-{slug}.php -> taxonomy-{taxonomy}.php -> taxonomy.php -> archive.php -> index.php. In your case the archive would be skipped, but my PHP file name should still come before your current taxonomy.php. Perhaps it's getting confused because you've registered the taxonomy slug with a dash - and it assumes that brand is the term inside taxonomy watchdog? –  Marc Dingena Mar 29 '13 at 9:08

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.