0

I am working with wordpress 3.1 and have custom post type of whitepaper. My single-whitepaper template seems to be working. But the archive template (archive-whitepaper.php) is not.

And this after I have added the new 'has_archive' parameter to my register post type function. I have tried setting it to true and I have tried setting it to a slug of 'whitepaper'

But when I hit the url example.com/whitepaper, I get a white screen. Here's my code:

register_post_type( 'whitepaper', array(
               'labels' => array(
               'name' => __( 'Whitepapers' ),
               'singular_name' => __( 'Whitepaper' ),
               'add_new' => __( 'Add New' ),
               'add_new_item' => __( 'Add New Whitepaper' ),
               'edit' => __( 'Edit' ),
               'edit_item' => __( 'Edit Whitepaper' ),
               'new_item' => __( 'New Whitepaper' ),
               'view' => __( 'View Whitepaper' ),
               'view_item' => __( 'View Whitepaper' ),
               'search_items' => __( 'Search Whitepapers' ),
               'not_found' => __( 'No whitepapers found' ),
               'not_found_in_trash' => __( 'No whitepapers found in Trash' ),
               'description' => __( 'Whitepaper type is used to post recommended viewing content for our users.' )                  
                  ),
                  'public' => true,
                  'show_ui' => true,
                  'publicly_queryable' => true,
                  'exclude_from_search' => false,
          'menu_position' => 5,
          'menu_icon' => get_stylesheet_directory_uri() . '/images/whitepaper.png',
          'query_var' => true,
          'supports' => array( 'title', 'editor', 'excerpt', 'custom-fields', 'thumbnail' ),
          'can_export' => true,
          'has_archive' => 'whitepaper'
 )
);

What am I doing wrong?

1 Answer 1

4

Save permalinks to flush your rewrite rules:

Saving Permalinks in WordPress to Flush rewrite rules

8
  • Thanks mike for the tip but there was a syntax error in my template. Issue solved Commented Mar 2, 2011 at 7:41
  • @Amit Erandole - What was the syntax error? I copied your code into my test site and it worked fine. Commented Mar 2, 2011 at 7:49
  • @Mike - Just visiting the permalinks page should be enough.
    – t31os
    Commented Mar 2, 2011 at 16:56
  • @t31os - Visiting the permalinks page should be enough for what? To see the error? I didn't see any errors on my test site. Commented Mar 2, 2011 at 20:42
  • @Mike - To update the rewrite rules silly ;-)
    – t31os
    Commented Mar 2, 2011 at 22:33

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.