将常规永久链接设置为
/blog/%postname%/
使用注册自定义帖子类型
has_archive => TRUE
和
with_front => FALSE
.
示例:
add_action ( \'init\', \'register_project_cpt\' );
function register_project_cpt()
{
register_post_type(
\'projects\',
array (
\'has_archive\' => TRUE,
\'hierarchical\' => TRUE,
\'public\' => TRUE,
\'publicly_queryable\' => TRUE,
\'rewrite\' => array (
\'slug\' => _x( \'projects\', \'slug\', \'text_domain\' ),
\'with_front\' => FALSE
),
\'show_in_nav_menus\' => TRUE,
\'show_in_menu\' => TRUE,
\'show_in_admin_bar\' => TRUE,
\'show_ui\' => TRUE,
\'supports\' => array(
\'author\',
\'comments\',
\'editor\',
\'excerpt\',
\'page-attributes\',
\'revisions\',
\'thumbnail\',
\'title\',
)
)
);
}
在中
wp-admin/options-reading.php
为博客文章存档选择一个页面,该页面将用于
/blog/
然后