0

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?

3
  • Is the post type registered with 'has_archive' set to true? Commented May 16, 2011 at 18:10
  • Yes it is - I did check that before I posted my question. Any other thoughts, please?
    – mktggirl
    Commented May 16, 2011 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. Commented Sep 9, 2011 at 18:58

1 Answer 1

1

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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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