2

I need help with understanding page naming to display a sub-category which only occurs only sometimes. I also need to understand if I need to create a custom Taxonomy to achieve this? I am using CPT UI plugin.

I have a CPT, called APPLES.

All of my main apple parent types are displaying as images on archive-apple.php. (maybe this should be page?). I will then click on the image of the parent apple type I want to know more about and I will see a sub-page of images/information about that specific kind of Apple.

BUT, Sometimes that individual Apple parent will have two or three variations of the main parent Apple. So an intermediary page with two sub-type images must display giving me the choice of what sub-type I want to see.

Here is a diagram to explain what I am trying to do. Please and thank you for any help.

enter image description here

1

What do u mean by:

Page naming

?? If you are after a way to implement this situation, then here you go:

You have 2 options:

1st Option

Use

'hierarchical'                  => false

while registering your apples post type, using register_post_type. Then, you will have the option to put apples posts, as parents and children, using the post edit page.

2nd Option:

Use

function add_apples_cat_taxonomy(){
    register_taxonomy(
        'apples_category',
        'apples',
        array(
            'label' => __( 'Apples category' ),
            'rewrite' => array( 'slug' => 'apples_cat' ),
            'hierarchical' => true
        )
    );
}

add_action( 'init', 'add_apples_cat_taxonomy' );

to add an post_type dependent taxonomy named apples_category, and use it to expand the desired hirearchy.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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