문제

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' => true,
 )

);

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

도움이 되었습니까?

해결책 2

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

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top