Custom breadcrumbs for Pods content types using Yoast SEO?
-
Suppose my URL structure is:
domain.tld/books/ [overview of books]
domain.tld/book/book-A/
domain.tld/book/book-B/Currently, the breadcrumbs for book A are:
Home > Book A
I would like my breadcrumbs to be:
Home > Overview of books > Book A
(Whereby ‘Overview of books’ should link to the books overview page.) How do I accomplish that?
I’m using the Yoast SEO plugin and Woocommerce, with which I managed to create a somewhat similar concept for Woocommerce products:
add_filter( 'wpseo_breadcrumb_links', 'wpseo_breadcrumb_add_woo_shop_link' ); function wpseo_breadcrumb_add_woo_shop_link( $links ) { global $post; if ( is_woocommerce() ) { $breadcrumb[] = array( 'url' => get_permalink( wc_get_page_id( 'shop' ) ), 'text' => get_the_title( get_page_by_path( 'webshop' ) ), ); array_splice( $links, 1, -2, $breadcrumb ); } return $links; }
This is code I modified based on https://gist.github.com/amboutwe/ea0791e184668a5c7bd7bbe357c598e9
However, I don’t know whether this concept also works for Pods, and if so, how to target Pods content types to create custom breadcrumbs.
- The topic ‘Custom breadcrumbs for Pods content types using Yoast SEO?’ is closed to new replies.