Question

I have a custom post type, called 'job', and I have the following templates in my theme:

  • single-job.php (works fine, displays single job as expected)

  • archives-job.php (is not recognized?)

  • archives-current.php (also not recognized)

  • archives.php (is not recognized either?)

  • index.php (archives page uses this page)

Here is how I've registered my custom content type in functions.php:

add_action( 'init', 'create_jobs' );
function create_jobs() {
  $labels = array(
    'name' => _x('Jobs', 'post type general name'),
    'singular_name' => _x('Job', 'post type singular name'),
    'add_new' => _x('Add New', 'Job'),
    'add_new_item' => __('Add New Job'),
    'edit_item' => __('Edit Job'),
    'new_item' => __('New Job'),
    'view_item' => __('View Job'),
    'search_items' => __('Search Jobs'),
    'not_found' =>  __('No Jobs found'),
    'not_found_in_trash' => __('No Jobs found in Trash'),
    'parent_item_colon' => ''
  );

  $supports = array('title', 'editor', 'custom-fields', 'revisions', 'excerpt');

  register_post_type( 'Job',
    array(
      'labels' => $labels,
      'public' => true,
      'has_archive' => 'current', 
      'supports' => $supports
    )
  );
}

When i go to the url http://mywebsite/wordpress/current/, it displays all of my jobs as expected-- but it is not using ANY of the archive templates, and instead uses index.php.

My understanding of the wordpress documentation was that it would look for archives-(special archive for post type name).php, then archives-(post type).php, then archives.php, then index.php... but it just goes straight to index.php?

I did visit the permalinks settings page and clicked save to refresh everything, so I'm not getting 404's, it's just not outputting to the correct templates... did I name them incorrectly? Is there a registration setting I missed when I created my custom post type?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top