I created a custom type name 'feed', then create some template files as single-feed.php
, feed.php
, taxonomy.php
and archive-feed.php
but all of them don't work.
I get error "ERROR: This is not a valid feed template.
"
Here is my code
add_action( 'init', 'create_posttype' );
function create_posttype() {
register_post_type( 'feed',
array(
'labels' => array(
'name' => __( 'Feed' ),
'singular_name' => __( 'Feed' ),
'not_found' => __('No feed found'),
'not_found_in_trash' => __('No feed found in Trash')
),
'public' => true,
'has_archive' => true,
'rewrite' => array('slug' => 'feed','with_front'=>FALSE),
'supports' => array('title','author', 'editor')
)
);
flush_rewrite_rules();
}
register_taxonomy("feedgroup", array("feed"),
array("hierarchical"=> true, "label" => "Feed Group", "singular_label" => "Feed", "rewrite"=> true,'query_var' => true,'taxonomies'=>array('post-tag','feedgroup'),'slug'=>'feed'));
feed
is a reserved name and should not be used by themes or plugins.
There is no work around to this problem. The only solution you have is to rename your custom post type to maybe feeds
You can get a list of reserved names here. Just a note, although this is on the register_taxonomy
page, this list applies side wide for any naming convension, not just taxonomies