admin管理员组文章数量:1194125
I created a review website recently where I write website and product reviews.I intend to write blog posts too on my website. I don't want to create subdomain or separate blog page.Both review posts and blog should be on same website.But problem is both blog posts and reviews are mixed up in categories. For example a blog post on "How to start affiliate marketing" is a blog post and "Clickbank or Shareasale review " is review post.Both lies in same category named "Affiliate marketing"
How can I differentiate these posts so when user click on blog from menu only blog posts show up and when click review only review posts should show. I have mentioned categories as submenu too in both blog and review link too
I created a review website recently where I write website and product reviews.I intend to write blog posts too on my website. I don't want to create subdomain or separate blog page.Both review posts and blog should be on same website.But problem is both blog posts and reviews are mixed up in categories. For example a blog post on "How to start affiliate marketing" is a blog post and "Clickbank or Shareasale review " is review post.Both lies in same category named "Affiliate marketing"
How can I differentiate these posts so when user click on blog from menu only blog posts show up and when click review only review posts should show. I have mentioned categories as submenu too in both blog and review link too
Share Improve this question edited Jul 21, 2022 at 9:31 Hamza Jameel asked Jul 21, 2022 at 9:31 Hamza JameelHamza Jameel 11 bronze badge1 Answer
Reset to default 0Sounds like you're sharing the default category taxonomy for both of your post types. When you want separate categories per post type, you would need to create a custom taxonomy for your review posts.
Please check out the register_taxonomy
function in the WordPress developers documentation.
https://developer.wordpress.org/reference/functions/register_taxonomy/
See below an example of a custom taxonomy.
add_action( 'init', 'my_review_cat_init', 0 );
function my_review_cat_init() {
$labels = array(
'name' => '',
'singular_name' => '',
'search_items' => '',
'all_items' => '',
'parent_item' => '',
'parent_item_colon' => '',
'edit_item' => '',
'update_item' => '',
'add_new_item' => '',
'new_item_name' => '',
'menu_name' => '',
);
register_taxonomy( 'review_cat', array('review'), array(
'hierarchical' => true,
'public' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'meta_box_cb' => true,
'query_var' => true,
'publicly_queryable' => true,
'public' => true,
'rewrite' => array('with_front' => false),
));
}
本文标签: postsSeparate blog and reviews categories
版权声明:本文标题:posts - Separate blog and reviews categories 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738494216a2089883.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论