重复的管理菜单帖子页面
Duplicate admin menu posts page
我有一个 Wordpress 网站,我使用 'Posts' 菜单创建产品页面,因为该网站用作目录,没有在线购买。我现在正尝试在同一个安装中建立一个博客。是否可以复制 'Posts' 菜单选项和页面功能来为 'Blog' 创建一个新的管理菜单。我的目标是让博客和产品分开运行,这样您在博客部分就无法访问产品 post。
是的,您需要创建一个新的 post 类型。
请检查这个插件,这对你有很大帮助。 https://wordpress.org/plugins/custom-post-type-ui/
谢谢。
感谢@Dipak Dholakiya。该插件效果很好,尽管我决定不使用插件。我找到了 'wpEASYtuts' 发布的解决方案。我设置了一个新的自定义 Post 类型并将其用于产品。这是在我的 functions.php 文件中
function product_post() {
$labels = array(
'name' => _x( 'Products', 'post type general name' ),
'singular_name' => _x( 'Product', 'post type singular name' ),
'add_new' => _x( 'Add New', 'product' ),
'add_new_item' => __( 'Add New Product' ),
'edit_item' => __( 'Edit Product' ),
'new_item' => __( 'New Product' ),
'all_items' => __( 'All Products' ),
'view_item' => __( 'View Product' ),
'search_items' => __( 'Search Products' ),
'not_found' => __( 'No product found' ),
'not_found_in_trash' => __( 'No product found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Products',
);
$args = array(
'labels' => $labels,
'description' => 'Holds product and product specific data',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'has_archive' => true,
'taxonomies' => array( 'category', 'post_tag' ),
);
register_post_type( 'products', $args );
}
add_action( 'init', 'product_post' );
然后继续使用 'single.php' 文件重命名为 'single-products.php'。
希望这对遇到同样情况的人有所帮助。
我有一个 Wordpress 网站,我使用 'Posts' 菜单创建产品页面,因为该网站用作目录,没有在线购买。我现在正尝试在同一个安装中建立一个博客。是否可以复制 'Posts' 菜单选项和页面功能来为 'Blog' 创建一个新的管理菜单。我的目标是让博客和产品分开运行,这样您在博客部分就无法访问产品 post。
是的,您需要创建一个新的 post 类型。
请检查这个插件,这对你有很大帮助。 https://wordpress.org/plugins/custom-post-type-ui/
谢谢。
感谢@Dipak Dholakiya。该插件效果很好,尽管我决定不使用插件。我找到了 'wpEASYtuts' 发布的解决方案。我设置了一个新的自定义 Post 类型并将其用于产品。这是在我的 functions.php 文件中
function product_post() {
$labels = array(
'name' => _x( 'Products', 'post type general name' ),
'singular_name' => _x( 'Product', 'post type singular name' ),
'add_new' => _x( 'Add New', 'product' ),
'add_new_item' => __( 'Add New Product' ),
'edit_item' => __( 'Edit Product' ),
'new_item' => __( 'New Product' ),
'all_items' => __( 'All Products' ),
'view_item' => __( 'View Product' ),
'search_items' => __( 'Search Products' ),
'not_found' => __( 'No product found' ),
'not_found_in_trash' => __( 'No product found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Products',
);
$args = array(
'labels' => $labels,
'description' => 'Holds product and product specific data',
'public' => true,
'menu_position' => 5,
'supports' => array( 'title', 'editor', 'thumbnail' ),
'has_archive' => true,
'taxonomies' => array( 'category', 'post_tag' ),
);
register_post_type( 'products', $args );
}
add_action( 'init', 'product_post' );
然后继续使用 'single.php' 文件重命名为 'single-products.php'。
希望这对遇到同样情况的人有所帮助。