Superfish: Getting Page Children to Style like Categories Children
-
Hi,
Using the Clean Blog theme. Right now, my site Personal Wings has the Post Categories as my top menu. When I switch the code in my header.php to replace the categories with pages, my UL CSS for the children pages is no longer applied.
I looked at the difference and it seems Categories child UL is getting the class=”children” whereas the Pages child UL is not getting a declared class.
Any thoughts on where I need to add the code (js/php/xhtml) to get Page children to receive the same UL class=”children” that Category children get?
Thanks
<div id="categories_menu"> <ul class="sf-menu sf-js-enabled"> <?php //wp_list_categories('show_count=0&title_li='); ?> <?php wp_list_categories('title_li='); ?> <!-- CHANGE TO wp_list_pages produces no declared class for child pages --> </ul> </div>
-
Found this in the classes.php – seems to be giving the children pages a class of “children” for the UL… Any thoughts on how to get pags AND categories to respond to this?
Thanks
/** * @see Walker::start_lvl() * @since 2.1.0 * * @param string $output Passed by reference. Used to append additional content. * @param int $depth Depth of category. Used for tab indentation. * @param array $args Will only append content if style argument value is 'list'. */ function start_lvl(&$output, $depth, $args) { if ( 'list' != $args['style'] ) return; $indent = str_repeat("\t", $depth); $output .= "$indent<ul class='children'>\n"; }
Use
#categories_menu .children li
?Sorry, should address that the CSS is calling out the .children li:
li.submenu ul { margin-bottom:0; } li.submenu ul li { line-height:20px; } #categories_menu { position:absolute; z-index:15; top:55px; left:320px; } #categories_menu ul li { margin-right:1.1em; } #categories_menu ul li a { color:#6F6C61; font-size:1.5em; text-decoration:none; padding:0 5px; margin:0; border:0; } #categories_menu ul li.current-cat a, #categories_menu ul li.current-cat-parent a, #categories_menu ul.children li.current-cat a { color:#00ABEF; } #categories_menu ul.children li { background-color:#ffffff; /*margin-bottom:.5em;*/ } #categories_menu ul.children li a { font-size:1.1em; color:#464749; } li.sfHover a, #categories_menu ul li a:hover { color:#004096; }
Seems the issue is with the php differences btw wp_list_categories function and the wp_list_page function
Since I couldn’t find anything to help on the php side of things, I just assigned a nested ul css to apply to “page_item” li’s under the parent id.
Works!
- The topic ‘Superfish: Getting Page Children to Style like Categories Children’ is closed to new replies.