• How can I display a list of child categories of a custom post separated by commas, and the child categories are clickable links, directing to show all custom posts that belong to that child category?

    I used a commercial theme Realia which defined a custom post type called agency and it’s on TWIG.

    I have registered a taxonomy category to this agency custom post type by having these code:

    register_post_type( 'agency',
    		array(
    			'labels'        => $labels,
    			'rewrite'       => array(
    				'slug' 		=> __( 'agencies', 'aviators' ),
    			),
    			'hierarchical'  => true,
    			'supports'      => array( 'title', 'editor', 'thumbnail', 'page-attributes' ),
    			'public'        => true,
    			'has_archive'   => true,
    			'menu_position' => 32,
    			'taxonomies' 	=> array('category'),
    			'menu_icon'     => get_template_directory_uri() . '/aviators/plugins/agencies/assets/img/agencies.png',
    		)
    	);
    
    	register_taxonomy_for_object_type( 'category', 'agency' );

    The category of this custom post type works fine.

    As said, I want to display all the child categories a particular post belongs to, which function should I use?

  • The topic ‘How to display a list of the categories that a custom post belongs to?’ is closed to new replies.