Open mehrshaddarzi opened 3 years ago
I'm assuming array as expected returned value? something like,
[
'active' => true,
'activeAncestor' => false,
'activeParent' => false,
'classes' => 'classes',
'description' => 'description',
'id' => 1,
'label' => 'Sample Page',
'objectId' => 2 // postId
'parent' => false, // parent menu item id
'slug' => 'sample-page',
'target' => false,
'title' => false, // title attribute
'url' => 'https://foo.bar/sample-page',
]
With that, we can loop it over in a template.
@iniznet please see this file: https://github.com/thebatclaudio/wp-rest-api-v2-menus/blob/master/wp-rest-api-v2-menus.php
We want to Create a Menu Collection With three Methods: 1) Get all list Menu With Custom Meta Term 2) Get all List Locations Menu 3) Get Menu List item By ID or Name
Your proposed array is missing three points:
1- Every Menu Item List is a Post in WordPress Database, We must add Meta
Parameter.
2- WordPress Menu is a Nested System, we Must add children
Parameter.
3- We Prefer All Methods return Object
in This Package.
https://github.com/thebatclaudio/wp-rest-api-v2-menus