• Resolved iyamdman

    (@iyamdman)


    I have two Custom Post types:

    The first one is called “Cars”

    “Cars” posts have the following Taxonomies:

    “Series Name” – Example: First Series, Collectors, Fast Ones
    “Series Year” – Example: 1967, 1990, 2005
    “Body Color” – Example: Blue, Red, Green

    The other post type is called “wheels”

    Each “Wheels” post has one Taxonomy:

    “Format” – Example:PR5, RL, RLRR5SP

    What I want is that, when I add a “Cars” post, there will be an admin box with a list of check boxes for all the different “wheels” taxonomy entries.

    I know how to make the Custom Posts, and the Custom Taxonomies, but I don’t know how to do the above.

    Can anyone give me a clue as to how to do this, or if it is even possible?

Viewing 1 replies (of 1 total)
  • Hey iyamdman,

    I assume you are talking about the checkboxes similar to the posts page with different categories?

    You need to link custom posts and register taxonomies (in functions.php)

    add_action( 'init', 'build_taxonomies', 0 );
    function build_taxonomies() {
        register_taxonomy( 'taxonomy-name', array('cars'), array( 'hierarchical' => true, 'label' => 'Series Name', 'query_var' => true, 'rewrite' => true ) );
    	register_taxonomy( 'taxonomy-year', array('cars'), array( 'hierarchical' => true, 'label' => 'Series Year', 'query_var' => true, 'rewrite' => true ) );
    	register_taxonomy( 'taxonomy-color', array('cars'), array( 'hierarchical' => true, 'label' => 'Body Color', 'query_var' => true, 'rewrite' => true ) );
    	register_taxonomy( 'taxonomy-format', array('wheels'), array( 'hierarchical' => true, 'label' => 'Format', 'query_var' => true, 'rewrite' => true ) );
    }

    If you want to reuse taxonomies across multiple custom posts, you can add the support by specifying the names of each post_type.

    For example: array(‘cars’, ‘wheels’, ‘page’, ‘post’)

    register_taxonomy( 'taxonomy-format', array('wheels', 'cars'), array( 'hierarchical' => true, 'label' => 'Format', 'query_var' => true, 'rewrite' => true ) );

    The code above will display the taxonomy in both wheels and cars.

    Hope that helps, if I am a bit confusing I can explain in better detail. Just need to know exactly what you want to achieve.

Viewing 1 replies (of 1 total)
  • The topic ‘Help: Need to link taxomonies in Custom posts admin panel’ is closed to new replies.