• Hello, the Posts Breadcrumb are without categories ??
    I use Yoast Breadcrumb but shema data only contain home and post, not categories between.

    I use /%category%/%postname%/ for post permalinks i think that’s why its not working properly.

    Thx for help

    • This topic was modified 6 years, 2 months ago by thaistiti.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter thaistiti

    (@thaistiti)

    Hi, i think this is some part of the code to use ?

    private function maybe_add_taxonomy_crumbs_for_post() {
        if ( WPSEO_Options::get( 'post_types-' . $this->post->post_type . '-maintax' ) && (string) WPSEO_Options::get( 'post_types-' . $this->post->post_type . '-maintax' ) !== '0' ) {
            $main_tax = WPSEO_Options::get( 'post_types-' . $this->post->post_type . '-maintax' );
            if ( isset( $this->post->ID ) ) {
                $terms = get_the_terms( $this->post, $main_tax );
     
                if ( is_array( $terms ) && $terms !== array() ) {
     
                    $primary_term = new WPSEO_Primary_Term( $main_tax, $this->post->ID );
                    if ( $primary_term->get_primary_term() ) {
                        $breadcrumb_term = get_term( $primary_term->get_primary_term(), $main_tax );
                    }
                    else {
                        $breadcrumb_term = $this->find_deepest_term( $terms );
                    }
     
                    if ( is_taxonomy_hierarchical( $main_tax ) && $breadcrumb_term->parent !== 0 ) {
                        $parent_terms = $this->get_term_parents( $breadcrumb_term );
                        foreach ( $parent_terms as $parent_term ) {
                            $this->add_term_crumb( $parent_term );
                        }
                    }
     
                    $this->add_term_crumb( $breadcrumb_term );
                }
            }
        }
    }
    Thread Starter thaistiti

    (@thaistiti)

    Is it possible to have some support please ?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Posts Breadcrumb are without categories’ is closed to new replies.