Breadcrumb – Getting Nav Menu Items

Question

I would like to create a custom breadcrumb function that uses the created Nav Menu in the WP Admin Panel. I’ve seen register_nav_menu and wp_nav_menu for themes, but they’re irrelevant as I’m using Elementor.

How do I get a created Menu Name and their respective items into a variable or array and print them?
I also would like to get current page.

Example
Menu Name: Test1
Depth: 1
Pages: Page A, Page B, Page C

Process

$Nav_Menu_Name = Test1;
$Nav_Menu_Items = [ 'a' => 'Page A', 'b' => 'Page B', 'c' => 'Page C'];

//I would like to get current page and style it with CSS if it matches any of the existing items.
//if (Get_Current_Page = $Nav_Menu_Items [0]) { echo '<h1> </h1'; }

echo $Nav_Menu_Items[0] . '>' . $Nav_Menu_Items[1] . '>' . $Nav_Menu_Items[2]

Output
Page A > Page B > Page C

Thank you

0
Valeron 2 months 0 Answers 16 views 0

Leave an answer