wp_nav_menu SHORTHAND? SYNTAX?
-
Can anyone explain what is happening here:
wp_nav_menu( ‘sort_column=menu_order&menu_location=main-menu&container_id=nav&menu_class=sf-menu’ )
When I try to find info online, all I get is how to work with very clean and organized arrays:
http://codex.wordpress.org/Function_Reference/wp_nav_menu
… to be more specific, what is this: “sort_column=menu_order&menu_location=main-menu&container_id=nav&menu_class=sf-menu”
Thanks
-
It’s just another way of coding the attributes for wp_nav_menu. You could equally write it as:
$args ' => ' array( 'sort_column' => 'menu_order', 'menu_location' => 'main-menu', 'container_id' => 'nav', 'menu_class' => 'sf-menu' ); wp_nav_menu( $args );Is that more like the examples you’ve seen?
Thank you for your prompt response but can you extend further? I can easily understand your example but I want to understand what is happening here as well: “sort_column=menu_order&menu_location=main-menu&container_id…”
I can’t seem to find the relationship! what is “=” and what is “&” doing in this case?
If you have a link to a tutorial, i would pretty much appreciate it.
Key value pairs: http://en.wikipedia.org/wiki/Attribute-value_pair
Query String: http://en.wikipedia.org/wiki/Query_string
Associative arrays: http://en.wikipedia.org/wiki/Associative_array“sort_column=menu_order&menu_location=main-menu&container_id…” is a query string part with a series of key value pairs
Esmi’s PHP array is the same set of key value pairs in an associative arrayThank you tcbarrett!!!
So this is a query string!
field1=value1&field2=value2&field3=value3…
“The series of pairs is separated by the ampersand, ‘&’ or semicolon, ‘;’.” from wiki
The topic ‘wp_nav_menu SHORTHAND? SYNTAX?’ is closed to new replies.