Open woodz- opened 5 years ago
Hey there, thanks for flagging this as not easy to understand. The instructors could be expanded and clarified a bit but I am not great at writing documentation like this. Would you consider making a PR with your suggested changes and I'll merge those in?
@pattonwebz, sure I could do that. If we could have a living conversation here, wehre I will ask you about concrete details for parameterization of the function in your templates would obviously ease the task.
Of course we can have a conversation and I can answer the questions, I did not mean it to look like I was about to skip over them and never come back lol
I planned to cycle back here tomorrow and answer them once I'm at my desk. It's already late for me and it's hard to scroll back and forth answering on mobile.
We can catch up tomorrow about it and thank you for helping to improve and make things more understandable. It will ease a lot of people's getting started worries or confusions the docs create :)
@woodz- , you need to put the "id" of the theme_location in there. Somewhere in your theme there is something like
function prefix_register_nav_menu(){
register_nav_menus( array(
'id_theme_location_1' => __( 'Name theme location 1', 'text_domain' ),
'id_theme_location_2' => __( 'Name theme location 1', 'text_domain' ),
) );
}
If you created a menu and assigned it to, e.g., 'Name theme location 1', then you have to use 'id_theme_location_1' in your wp_nav_menu()
. As the menues registered depend on your theme and not your WordPress version - unless you use its default theme -, it should be totally independent of whether WordPress names something "Main Navigation" or "It's the end of the world".
I feel the meaning of the array arguments of the
register_nav_menus()
function is not really clear (maybe for newcomers only). Furthermore how the dict key'primary'
fits towp_nav_menu()
's'theme_location'
is not clear.Why I am stating this is, because in my case I already have a working menu defined in wp-admin. Its name is 'Mainmenu'. And I want to apply it for the nav_walker instead of using it in a previous fusion based theme.
If I put this name into
register_nav_menus()
array instead of'Primary Menu'
, it won't take effect. Even if I create a new menu in wp-admin with the name 'Primary Menu', it won't show up.The only thing that worked for me was to leave the value of key 'primary' empty in
wp_nav_menu
function. Thus I feel I canceled out the concept of 'primary' completely as any change of the parameters ofregister_nav_menus()
won't have any more consequence.The statement
makes the situation more confusingly, since it is not clear what
mean. By its name? By its option under "Menu Settings" of the wp-admin? By Theme Location under "Manage Locations" of the wp-admin? ...
Also, some identifiers seem to have changed with newer wordpress versions like "Main Navigation" in wp-admin.
Would it be possible to expand the instructions by concrete samples where one can see which values are gonna be replaced? Plus mention the version of wordpress, which had been the base by the time of writing the instructions.