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.

I have a custom post type called 'business_sold' that is not reading archive-business_sold.php but instead is reading index.php. The custom post type is however, properly reading single-business_sold.php.

This is how I registered the custom post type (initially via a plugin through which single-business_sold.php worked) and then I manually added the following code to functions.php:

register_post_type('Business_Sold', array(  'label' => 'Businesses Sold','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => ''),'query_var' => true,'has_archive' => true,'menu_position' => 5,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'Businesses Sold',  
  'singular_name' => 'Business Sold',  
  'menu_name' => 'Businesses Sold',  
  'add_new' => 'Add Business Sold',  
  'add_new_item' => 'Add New Business Sold',  
  'edit' => 'Edit',  
  'edit_item' => 'Edit Business Sold',  
  'new_item' => 'New Business Sold',  
  'view' => 'View Business Sold',  
  'view_item' => 'View Business Sold',  
  'search_items' => 'Search Businesses Sold',  
  'not_found' => 'No Businesses Sold Found',  
  'not_found_in_trash' => 'No Businesses Sold Found in Trash',  
  'parent' => 'Parent Business Sold',  
),) );

Any ideas on why this is happening?

share|improve this question
    
Is the post type registered with 'has_archive' set to true? –  goldenapples May 16 '11 at 18:10
    
Yes it is - I did check that before I posted my question. Any other thoughts, please? –  mktggirl May 16 '11 at 20:52
1  
Are slugs case-sensitive with respect to the template hierarchy? You've registered Business_Sold as the CPT slug, rather than business_sold. So if that slug is case-sensitive, the template hierarchy might be looking for single-Business_Sold.php, rather than single-business_sold.php. –  Chip Bennett Sep 9 '11 at 18:58
add comment

1 Answer

When you register custom post in functions.php add this 'has_archive' => 'book-list' and then your archive-business_sold.php will work See this article for details http://www.wpmods.com/wordpress-3-1-custom-post-type-archives

Or just use plugin (for example http://wordpress.org/extend/plugins/simple-custom-post-type-archives)

share|improve this answer
add comment

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.