0

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

See image for reference

1 Answer 1

0

Sounds 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),
    ));

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.