开发者

Wordpress Custom Post Type Archives

I have added the following to my functions.php file

register_post_type( 'news',
 array(
   'labels' => array(
     'name' => __( 'News' ),
     'singular_name' => __( 'News' ),
 'add_new' => __( 'Add New Article' ),
 'add_new_item' => __( 'Add Article' ),
 'edit_item' => __( 'Edit Article' ),
 'new_item' => __( 'New Article' ),
 'view_item' => __( 'View Article' ),
 'search_items' => __( 'Search Articles' ),
 'not_found' => __( 'No Articles Found' ),
 'not_found_in_trash' => __( 'No Articles Found In Trash' ),
 'rewrite' => array(
    'slug' => 'news',
    'with_front' => false
    ),
 'has_archive' => true,
   ),
   'public' => tru开发者_如何学Ce,
 )

);

But when i type in news after my site mysite/news/ I get a page not found when it should I gather be listing my archives for news with the has_archives option.

What am I doing wrong!!!

By the way I have an archives.php file


Go into permalinks and save the settings to refresh the permalink structure. Wordpress has a problem with the custom post type permalinks you have to do this every time you make a change to you custom post type. This will prevent your from getting a 404 error.


Solved its not actually been released yet, the feature. I had to download the beta version however this version of wordpress is due soon.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜