WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to make the parent invisible ?

[Resolved] How to make the parent invisible ?

  • in my unordered list directory ( built from categories ) the parents are visible, the children indented. is there a way to make the parent invisible / hidden / display none ? ideally the parent not only becomes invisible, the space it takes up is eliminated too.

Viewing 7 replies - 1 through 7 (of 7 total)
  • esmi

    @esmi

    Forum Moderator

    Site url?

    under “function” = would like to remove “objects”
    under “talent” = would like to remove “talent”

    Objects list

    esmi

    @esmi

    Forum Moderator

    What code are you using to create these lists?

    here is a snippet. note: “Objects >” ID = 148 …

    <div class="column span-7 colborder">
    <a name="main"></a>
    		<h2>Browse the Objects...</h2>
    
    				<h3>by function:</h3>
    				<ul class="sidenav">
    <?php wp_list_categories('title_li=&exclude=3,4,23,27,32,33,82,103,144,147,372,23,365,24,25,26,104,406,443,626, 2263, 2273, 2277, 2288, 2289, 2290, 2291, 2292, 2293, 2294, 2295, 2296, 2297'); ?> <!-- 3/9/2010 -->				</ul>
    
    	</div>

    note: the above code is tedious in that every time i add a category i have to exclude it. is there an easier way to call only the ones i want? i have this code on another page…

    <?php
    	$catarray = array(213, 214, 215);
    
    	foreach($catarray as $cat) {

    then some call i think…

    esmi

    @esmi

    Forum Moderator

    I don’t know how you have your categories and sub-categories organised but what about using the child_of parameter with wp_list_categories instead of all of those excludes? That might also deal with the unwanted parent (top level) list item display.

    childof_ works for most of the categories…

    but i still have to exclude a significant # from this <div> as i have over 122 categories and counting….
    <?php wp_list_categories('title_li=&childof=150, 208, 209, 153, 210&exclude=3, 24, 25, 26, 33, 82, 103, 144, 372, 406, 443, 626, 2263'); ?>

    the parent of 150,208,153,210 is still visible. the children of 150, etc., which is over 85 categories, is listed, so the code is a lot less, thank you.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] How to make the parent invisible ?’ is closed to new replies.
Skip to toolbar