Created
July 11, 2011 08:57
-
-
Save prestarocket/1075565 to your computer and use it in GitHub Desktop.
wordpress : add last class to menu item
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 last_item class to last li in wp_nav_menu lists*/ | |
function add_last_item_class($strHTML) { | |
$intPos = strripos($strHTML,'menu-item'); | |
printf("%s last_item %s", | |
substr($strHTML,0,$intPos), | |
substr($strHTML,$intPos,strlen($strHTML)) | |
); | |
} | |
add_filter('wp_nav_menu','add_last_item_class'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment