jchristopher / menu-breadcrumb

[WordPress Plugin] Generate a breadcrumb trail from a WordPress Menu
GNU General Public License v2.0
20 stars 9 forks source link

Pages not on Menu #9

Open levycarneiro opened 1 year ago

levycarneiro commented 1 year ago

I have a site with the following structure on the Top Menu:

In the case of Chapter (CPT) pages the plugin doesn't add a breadcrumb because the Chapter is not in the Menu.

Is there a way that I can get the same breadcrumb array from a Book page, but on a Chapter page? So I can add custom code to fill out the additional item for the array with the Chapter name/url.

Note: when trying to play with the custom functions [1], I get an error "Uncaught Error: Class "Kadence\Menu_Breadcrumb" not found in /.../themes/kadence-child/header.php:57".

[1]

    $menu_breadcrumb = new Menu_Breadcrumb( 'primary' );   // 'main' is the Menu Location
    $current_menu_item_object = $menu_breadcrumb->get_current_menu_item_object();

Thanks!