Created
August 30, 2012 15:28
-
-
Save bmsterling/3530909 to your computer and use it in GitHub Desktop.
Add the first and last class to wp_list_pages for wordpress
This file contains hidden or 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
function wp_list_pages_add_first_last($content) { | |
$content = preg_replace('/li class\=\"/', 'li class="first ', $content, 1); | |
$content_rev = strrev($content); | |
$content_rev = preg_replace('/\"\=ssalc il/', ' tsal"=ssalc il', $content_rev, 1); | |
return strrev($content_rev); | |
} | |
add_filter('wp_list_pages','wp_list_pages_add_first_last'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment