Changing li class of "categories" or overriding it with CSS
-
So I currently have a drop down menu for my pages, and I want to add “Blog” to the page menu. I’ve made some progress, but am falling way short on something. Here is the code that has gotten me where I am:
<ul id="pagemenu"> <li <?php if(is_home()) { ?> class="current_page_item" <?php } ?>><a href="<?php echo get_option('home'); ?>/">Home</a></li> <?php wp_list_categories('orderby=name&include='); ?> <?php wp_list_pages('sort_column=menu_order&depth=3&title_li=&exclude=' ); ?> </ul>
The menu “works” perfectly, it adds one menu item, and the drop down functionality and drop down styling works perfectly. I’m having an issue with two things though.
The menu item is titled “categories” – I would much rather this read “blog” for space purposes.
No styling on the one menu item (the drop down for it looks fine, only the parent item is not styled). When I looked at the source code it shows as “<li class=”categories”>Categories- ” while the rest of the menu items read “<li class=”cat-item cat-item-17″>” the number there being the page category number.
I would give you the link, but right now it under development (obviously), but I am not the owner and shouldn’t open it up. I will be happy to give any additional code.Can I overcome the styling in CSS or is it due to the category-template.php file located under /wp-includes? Oh, and adding title_li to it gives the correct styling, but then the entire menu is of the blog categories and doesn’t show any pages.
Here are some screen caps to visualize what I am trying to explain.
http://imgur.com/sVThr.jpg – Page Menu
http://imgur.com/OpaYJ.jpg – Page menu (hover)Any help would be fantastic.
-
the word ‘categories’ is not a category list item, therefore does not get the same css classes;
it is the default title for the category list;
change it with thetitle_li=
parameter:
http://codex.wordpress.org/Template_Tags/wp_list_categoriesGot it!! Yup,
title_li=Blog
fixed the issue to name the menu item. Everything else was CSS. Thanks!#pagemenu li.categories { ... }
- The topic ‘Changing li class of "categories" or overriding it with CSS’ is closed to new replies.