Created
February 23, 2012 14:58
-
-
Save thomasgriffin/1893183 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'wp_nav_menu_args', 'tgm_custom_nav_menu_args' ); | |
function tgm_custom_nav_menu_args( $args ) { | |
$args['unique'] = $args['theme_location']; | |
return $args; | |
} | |
add_filter( 'wp_nav_menu_objects', 'tgm_filter_nav_menu', 10, 2 ); | |
function tgm_filter_nav_menu( $objects, $args ) { | |
foreach ( $objects as $object ) { | |
if ( isset( $args->unique ) ) | |
$object->url = add_query_arg( array( 'unique' => $args->unique, 'ref' => $args->theme_location ), $object->url ); | |
else | |
$object->url = add_query_arg( 'ref', $args->theme_location, $object->url ); | |
} | |
return $objects; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment