Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu Collection #20

Open
mehrshaddarzi opened this issue Oct 14, 2021 · 2 comments
Open

Menu Collection #20

mehrshaddarzi opened this issue Oct 14, 2021 · 2 comments

Comments

@mehrshaddarzi
Copy link
Owner

https://github.com/thebatclaudio/wp-rest-api-v2-menus

@iniznet
Copy link
Contributor

iniznet commented Oct 3, 2022

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.

@mehrshaddarzi
Copy link
Owner Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants