TransWikia.com

Breadcrumb - Getting Nav Menu Items

WordPress Development Asked by Valeron on February 18, 2021

I would like to create a 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

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP