• Resolved richyblue

    (@richyblue)


    Hello,

    I have a problem with my wordpress. I have to many subcategories about 130 and they look very ugly on the template.

    How to not display the subcategories and only the parent category, but after i click on parent category to display the subcategories only for that category.

    For example :
    Category 1: WordPress
    Category 2: Best
    Category 3: Blog

    After i click WordPress to display like this:

    1) WordPress
    > Subcategories
    > Problem
    > What to do. Is there a plugin?
    2) Best
    3) Blog

    If you have any solution or if you know a plugin that work for WP 2.7 please help me.

    Thank you and a best day,
    Richy

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter richyblue

    (@richyblue)

    I think this is a must that wordpress must develop !

    What can you do when you have 500 subcategories? … the theme will look incredible ugly.

    Thread Starter richyblue

    (@richyblue)

    I didn’t find any to work with 2.7 version…
    Interspire Website Publisher has this option, and is very customizable.
    I didn’t find this option with wordpress… maybe i’ll stick with them and renew my licence…

    Will keep searching in the meantime…

    Thread Starter richyblue

    (@richyblue)

    Yes but is not working with 2.7 .
    I found something after your advise: https://blog.robfelty.com/plugins/

    I will let people know if it works.

    I’ve just done it with a bucket load of CSS, I’m sure its not the anything like the best way but if your really stuck it:

    #newsContent ul li ul li a {
    background-color:#cdcdcd;
    border:1px solid #999999;
    color:#000;
    display:block;
    margin:0 0 5px;
    padding:5px 7px;
    width:284px;
    }
    
    #newsContent ul li ul li.cat-item ul.children {height: 0px; }
    #newsContent ul li ul li.cat-item ul.children li a {visibility: hidden; }
    
    #newsContent ul li ul li.current-cat ul.children, #newsContent ul li ul li.current-cat-parent ul.children
     {height: auto; }
    
    #newsContent ul li ul li.current-cat-parent ul.children li a, #newsContent ul li ul li.current-cat ul.children li a {
    background-color:#CDCDCD;
    border-color:#FFFFFF;
    color:#000000;
    font-size:85%;
    margin:-6px 0 5px 2px;
    padding:5px 0 3px 12px;
    visibility:visible;
    width:282px;
    }
    
    #newsContent ul li.current-cat a, #newsContent ul li.current-cat a:hover,
    #newsContent ul li.cat-item ul.children li.current-cat a, #newsContent ul li.cat-item ul.children li.current-cat a:hover
    { background: #fff; color: #000; }
    
    #newsContent ul li a:hover,
    #newsContent ul li.current-cat ul.children li a:hover,
    #newsContent ul li.current-cat-parent ul.children li a:hover { background: #fff; color: #E26524; }
    
    #newsContent ul li.current-cat-parent a {margin-bottom: 6px;}

    newsContent is the id of my side bar div, alot of the code is for styling the main point is to hide the sub cat unless its parent has an current-cat class.

    hope this helps

    Thread Starter richyblue

    (@richyblue)

    The plugin i posted works great.

    I am also looking for a solution to this problem . Like Richyblue, I have a few subcategories for each of the main categories and I would want to hide them. Basically I would want only the subcategories to appear only in the category pages under which these sub categories are listed.

    However i first need to trace as to how to exclude these subcategories from listing in the main page as well as other pages .

    I tried <?php wp_list_cats(‘exclude=4, 5’); ?> but doesn’t with the deprecated wp_list_categories.

    Have skimmed through most of the source but couldn’t find

    I Found a solution to my last query

    I just added &exclude=11 to this line

    <?php wp_list_categories('show_count=1&exclude=11&title_li=<h2>Categories</h2>'); ?>

    in my sidebar.php file and it excluded category with that specific id. It works perfect for me coz I dun want to have too many links on my pages as they are with minimum content.

    But the problem I still have is I would atleast want to have the subcategories in the category pages atleast. Just wondering if anyone could help me out on this.

    Would it be wise if i create a different sidebar.php file for each main category that will show subcategories for that category alone.

    Is there any one who could help me with this . I have included the following code to exclude the subcategories

    <?php wp_list_categories('show_count=1&exclude=11&title_li=<h2>Categories</h2>'); ?>

    It works fine but I have to many subcategories and It should be pretty difficult to add each of the ids for eg i have to exclude the subcategories 11-100 and the code above would go like

    <?php wp_list_categories('show_count=1&exclude=11,12,<strong>(till 100)</strong>&title_li=<h2>Categories</h2>'); ?>

    which is a bit difficult also the coding would be long. Is there anyway to include anything like “11+” which would automatically exclude all the categories from 11 till 100

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to make subcategory not show on parent category’ is closed to new replies.