I have a client that wants a blog, a press section, and a "More Posts" section for feel good, community service type of posts. I used the standard post type for the blog, and everything works fine. I registered the two other post types with this code which is within a custom_posts();
function that I add with add_action( 'init', 'custom_posts');
register_post_type( 'press',
// let's now add all the options for this post type
array( 'labels' => array(
'name' => __( 'Press', 'bonestheme' ),
'singular_name' => __( 'Press', 'bonestheme' ),
'all_items' => __( 'All Press', 'bonestheme' ),
'add_new' => __( 'Add New', 'bonestheme' ),
'add_new_item' => __( 'Add New Post', 'bonestheme' ),
'edit' => __( 'Edit', 'bonestheme' ),
'edit_item' => __( 'Edit Post', 'bonestheme' ),
'new_item' => __( 'New Post', 'bonestheme' ),
'view_item' => __( 'View Post', 'bonestheme' ),
'search_items' => __( 'Search Posts', 'bonestheme' ),
'not_found' => __( 'Nothing found in the Database.', 'bonestheme' ),
'not_found_in_trash' => __( 'Nothing found in Trash', 'bonestheme' ),
'parent_item_colon' => ''
),
'description' => __( 'Press', 'bonestheme' ),
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'show_ui' => true,
'query_var' => true,
'menu_position' => 8,
'rewrite' => array( 'slug' => 'press-posts' ),
'has_archive' => true,
'capability_type' => 'post',
'hierarchical' => false,
'supports' => array( 'title', 'thumbnail', 'excerpt', 'revisions', 'sticky', 'custom-fields', 'editor', 'author' )
)
);
register_post_type( 'more_posts',
array( 'labels' => array(
'name' => __( 'More Posts', 'bonestheme' ),
'singular_name' => __( 'Post', 'bonestheme' ),
'all_items' => __( 'All Posts', 'bonestheme' ),
'add_new' => __( 'Add New', 'bonestheme' ),
'add_new_item' => __( 'Add New Post', 'bonestheme' ),
'edit' => __( 'Edit', 'bonestheme' ),
'edit_item' => __( 'Edit Post', 'bonestheme' ),
'new_item' => __( 'New Post', 'bonestheme' ),
'view_item' => __( 'View Post', 'bonestheme' ),
'search_items' => __( 'Search Posts', 'bonestheme' ),
'not_found' => __( 'Nothing found in the Database.', 'bonestheme' ),
'not_found_in_trash' => __( 'Nothing found in Trash', 'bonestheme' ),
'parent_item_colon' => ''
),
'description' => __( 'More Posts', 'bonestheme' ),
'public' => true,
'publicly_queryable' => true,
'exclude_from_search' => true,
'show_ui' => true,
'query_var' => true,
'menu_position' => 9,
'rewrite' => array( 'slug' => 'more-posts' ),
'has_archive' => true,
'capability_type' => 'post',
'hierarchical' => false,
'supports' => array( 'title', 'thumbnail', 'excerpt', 'revisions', 'sticky', 'custom-fields', 'editor', 'author' ),
)
);
Press - archive is broken(404) when using custom permalinks (works fine with std perma)
More - archive is broken(404) when using custom permalinks (works fine with std perma)
More - category gives me a page, but returns no posts (there are 2 posts in there)
I am using this plugin to create the archive and category lists on the sidebar, it seems to be functioning correctly. The URLs it gives me are:
/press/2015/02/ - press archives
/more_posts/2015/02/ - more archive
/more-posts-category/giving-back/ - more categories
Aucun commentaire:
Enregistrer un commentaire