• Hi there,
    I am relativity new to WordPress & am trying incorporate Breadcrumbs into my own bespoke theme.
    In my functions I ave added the following code:

    function the_breadcrumb() {
    $sep = ' > ';
    
    if (!is_front_page()) {
    
        echo '<a href="';
        echo get_option('home');
        echo '">';
        bloginfo('name');
        echo '</a>' . $sep;
    
        if (is_category() || is_single() ){
            the_category(' z ');
        } elseif (is_archive() || is_single()){
            if ( is_day() ) {
                printf( __( '%s', 'text_domain' ), get_the_date() );
            } elseif ( is_month() ) {
                printf( __( '%s', 'text_domain' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'text_domain' ) ) );
            } elseif ( is_year() ) {
                printf( __( '%s', 'text_domain' ), get_the_date( _x( 'Y', 'yearly archives date format', 'text_domain' ) ) );
            } else {
                _e( 'Blog Archives', 'text_domain' );
            }
        }
    
        if (is_single()) {
            echo $sep;
            the_title();
        }
    
        if (is_page()) {
            echo the_title();
        }
    
        if (is_home()){
            global $post;
            $page_for_posts_id = get_option('page_for_posts');
            if ( $page_for_posts_id ) {
                $post = get_page($page_for_posts_id);
                setup_postdata($post);
                the_title();
                rewind_posts();
            }
        }
    
    }
    }

    Now these breadcrumbs work, but they do NOT display any parent pages or posts at all to let the user know where they are.

    Is there a way of doing so within WordPress without the use of a Plugin?

    Any help would be really appreciated.

    Thank you

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Breadcrumbs not displaying parent or custom post pages’ is closed to new replies.