Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

So I'm working with a non-wordpress theme called "Misty" and it uses this code to pull categories:

<li class="sidebox">
    <h3><?php _e('Categories','ml'); ?></h3>
    <ul id="catList">
        <?php
        if (function_exists('wp_list_categories'))
        {
            wp_list_categories("show_count=1&include=$catID&hierarchical=1&title_li=");
            wp_list_categories("show_count=1&child_of=$catID&hierarchical=1&title_li=");
        }
        else
        {
            wp_list_cats('optioncount=1');
        }
        ?>
    </ul>
</li>

What sucks is that I cant style parent / child categories different, I want to indent child categories but they all go by class=category ID

$catID is how I want to filter posts. 3 different domains are coming to this blog and I am taking where they came from and filtering posts that way. So far I've filtered the category and showed that categories sub-categories, but the subcategories have no way to be styled.

What's a good work around to style the child categories? Is there somewhere I can just add another class to the child LI's?

share|improve this question

2 Answers 2

up vote 2 down vote accepted

The child ul comes with the class "children", so you can use this to target your css.
ul.children li { }

Even without that, though, you could just use the hierarchy of lists to target..

ul#catList ul li { } would target any li within a ul, within the #catList ID.

share|improve this answer
    
They are all showing up under #catList for some reason... –  Howdy_McGee Jan 12 '12 at 20:36

You shouldn't have any problem making parent and child categories look different using CSS. Go to view source and you should see something like:

    <ul id="catList">

            <li class="cat-item cat-item-1"><a href="http://yourdomain.com/category/misc/" title="Miscellaneous and Unsorted Posts">Misc.</a> (1)
</li>
    <li class="cat-item cat-item-4"><a href="http://yourdomain.com/category/newsletter/" title="View all posts filed under Newsletters">Newsletters</a> (9)
<ul class='children'>
    <li class="cat-item cat-item-79"><a href="http://yourdomain.com/category/newsletter/test/" title="just a test. delete whenever.">test</a> (1)
</li>
</ul>
</li>

See where it says ul class="children" ? Make a default style for all category menu items and then override that with the "children" class (something like #catList ul.children li a {color: green} which would make all child category links green).

Hope that helps :)

share|improve this answer
    
:/ IDK why mines not doing that. I have them as subcategory posts in my wordpress admin panel, but when I view the page all of them are under catList –  Howdy_McGee Jan 12 '12 at 20:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.