So the idea of this tutorial is to display 'Previous Page' and 'Next Page' links on your site while adhering to the structure of your custom menu.
I am writing this on the the presumtion that:
First thing you will need (if you don't already) is the almighty WordPress REST API (Version 2).
Then you will need the Menu addon WP API Menus.
Once installed go ahead and test your menu. goto:
/wp-json/wp-api-menus/v2/menus/<id>
data for a specific menu./wp-json/wp-api-menus/v2/menu-locations/<location>
data for a menu in a specific menu location.
Here is an example call if your menu location is called 'main_navigation_menu'
/wp-json/wp-api-menus/v2/menu-locations/main_navigation_menu
If it's working you should see something like this.
'[{"ID":25,"order":1,"parent":0,"title":"Cool Menu Item","url":"http:\/\/... etc etc'
You want to make sure you pass your :slug into your controller through your $routeProvider. It should look something like this:
The :slug variable is essentially a 'catch all'. If you have a specific slug it may look like this.
Either way, it is important to know the slug for the next part.
So here is an example of the controller which is calling the JSON menu. If it sucessfully retrieves the menu we will log it to the console.
Once we have the JSON call working sweet. we have to:
So with our items passed though the scope all we have to do is display the menu data.
View the RepoI plan to style this page and make the tutorial better, however, if you can't wait you can follow me here @iamlukem and ask any questions.