So I’m reasonably new to WordPress, but have been able to solve most issues by myself up until now.

I have a custom post type - lets call it “Machines”. And in those machines, there is a category called “Machine_type”. And say I’ve made a machine type called “Scissor Lifts”, then another machine type called “electric scissor lifts” which is a child of “scissor lifts”.

I’d like to display this information on the single post page - so on the “electric scissor lifts” page, i’d like to display breadcrumbs like Machines - Scissor Lifts - Electric Scissor Lifts. But this seems almost impossible! I have tried using many different tutorials, but they seem to always display “Machines - - - Final machine name”, without the actual 2 categories I’d like to display!

It seems sort of crazy that there’s no simple inbuilt call for Category and Child Category! I was using this:

<?php $terms = get_the_terms( $post->ID , 'machine_type' ); 
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'machine_type' );
if( is_wp_error( $term_link ) )
echo '<p>Machine Type: <a href="' . $term_link . '">' . $term->name . '</a></p>';

But this obviously just dumps all the information out, no way to separate the parent and child categories nicely. Any help would be really gratefully received! Thank you :)

Read more here: WordPress - custom post type, displaying the parent and child categories


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , , , , ,

Wordpress related questions and answers: