saturnstroll Posted January 2, 2010 Share Posted January 2, 2010 I've successfully added a few classes to the first ul in wordpress' template tag: wp_page_menu, however, I haven't been able to add a class to the child ul nested in the first li. Anyone see what is missing? function add_menuclass($ulclass) { return preg_replace('/<ul>/', '<ul class="clearfix rMenu-hor rMenu">', $ulclass, 1); } function add_sub_menuclass($ulchildclass) { return preg_replace('/<ul>/', '<ul class="rMenu-expand">', $ulchildclass, 2); } add_filter('wp_page_menu','add_menuclass','add_sub_menuclass'); I entered "2" at the end, see: $ulchildclass, 2); I tried adding a div as 'TheFrosty' suggested in the comments on this tutorial http://themeshaper.com/adding-class-wordpress-page-menu/, but no go. Anyone have any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/186887-wordpresshow-to-add-a-class-to-a-child-unordered-list/ Share on other sites More sharing options...
saturnstroll Posted January 2, 2010 Author Share Posted January 2, 2010 Problem solved: http://themehybrid.com/support/topic/adding-class-to-child-ul-in-wp_page_menu Quote Link to comment https://forums.phpfreaks.com/topic/186887-wordpresshow-to-add-a-class-to-a-child-unordered-list/#findComment-987195 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.