Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have few pages

 - HOME
 - SERVICES
 ---- MY SERVICE

My problem is that when I open My service page the breadcrumb looks like this:

home > My service

And I would need the parent to be there:

home > services > my service

How can I do so?

-EDIT-

This is the content of my includes/breadcrumbs.php

<?php if ( class_exists( 'woocommerce' ) && is_woocommerce() ) return; ?>
<div id="breadcrumbs">
    <div class="container clearfix">
        <?php if(function_exists('bcn_display')) { bcn_display(); }
              else { ?>
                    <a href="<?php echo esc_url( home_url() ); ?>" class="breadcrumbs_home"><?php esc_html_e('Home','Harmony') ?></a> <span class="raquo">&gt;</span>

                    <?php if( is_tag() ) { ?>
                        <?php esc_html_e('Posts Tagged ','Harmony') ?><span class="raquo">&quot;</span><?php single_tag_title(); echo('&quot;'); ?>
                    <?php } elseif (is_day()) { ?>
                        <?php esc_html_e('Posts made in','Harmony') ?> <?php the_time('F jS, Y'); ?>
                    <?php } elseif (is_month()) { ?>
                        <?php esc_html_e('Posts made in','Harmony') ?> <?php the_time('F, Y'); ?>
                    <?php } elseif (is_year()) { ?>
                        <?php esc_html_e('Posts made in','Harmony') ?> <?php the_time('Y'); ?>
                    <?php } elseif (is_search()) { ?>
                        <?php esc_html_e('Search results for','Harmony') ?> <?php the_search_query() ?>
                    <?php } elseif (is_single()) { ?>
                        <?php $category = get_the_category();
                              if ( $category ) {
                                $catlink = get_category_link( $category[0]->cat_ID );
                                echo ('<a href="'.esc_url($catlink).'">'.esc_html($category[0]->cat_name).'</a> '.'<span class="raquo">&gt;</span> ');
                              }
                            echo get_the_title(); ?>
                    <?php } elseif (is_category()) { ?>
                        <?php single_cat_title(); ?>
                    <?php } elseif ( is_tax() ) { ?>
                        <?php
                            $et_taxonomy_links = array();
                            $et_term = get_queried_object();
                            $et_term_parent_id = $et_term->parent;
                            $et_term_taxonomy = $et_term->taxonomy;

                            while ( $et_term_parent_id ) {
                                $et_current_term = get_term( $et_term_parent_id, $et_term_taxonomy );
                                $et_taxonomy_links[] = '<a href="' . esc_url( get_term_link( $et_current_term, $et_term_taxonomy ) ) . '" title="' . esc_attr( $et_current_term->name ) . '">' . esc_html( $et_current_term->name ) . '</a>';
                                $et_term_parent_id = $et_current_term->parent;
                            }

                            if ( !empty( $et_taxonomy_links ) ) echo implode( ' <span class="raquo">&gt;</span> ', array_reverse( $et_taxonomy_links ) ) . ' <span class="raquo">&gt;</span> ';

                            echo esc_html( $et_term->name );
                        ?>
                    <?php } elseif (is_author()) { ?>
                        <?php
                            global $wp_query;
                            $curauth = $wp_query->get_queried_object();
                        ?>
                        <?php esc_html_e('Posts by ','Harmony'); echo ' ',$curauth->nickname; ?>
                    <?php } elseif (is_page()) { ?>
                        <?php the_title(); ?>
                    <?php } elseif ( is_post_type_archive() ) { ?>
                        <?php post_type_archive_title(); ?>
                    <?php } ?>
        <?php } ?>
    </div> <!-- end .container -->
</div> <!-- end #breadcrumbs -->

Well, I solved by inserting this in my code (checking first if $post->post_parent > 0):

<?php $permalink = get_permalink($post->post_parent); ?>
<a href="<?php echo $permalink; ?>"Parent</a>
share|improve this question
    
How are you displaying the breadcrumb? Are you using any plugin? –  Vinod Dalvi May 9 '13 at 9:53
    
Edited with the includes/breadcrumbs.php of the Harmony Theme –  Toni Michel Caubet May 9 '13 at 10:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.