WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to make the parent invisible ? (8 posts)

  1. ronchicago
    Member
    Posted 4 years ago #

    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.

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Site url?

  3. ronchicago
    Member
    Posted 4 years ago #

    under "function" = would like to remove "objects"
    under "talent" = would like to remove "talent"

    http://designapplause.com/objects-list/

  4. esmi
    Forum Moderator
    Posted 4 years ago #

    What code are you using to create these lists?

  5. ronchicago
    Member
    Posted 4 years ago #

    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>
  6. ronchicago
    Member
    Posted 4 years ago #

    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...

  7. esmi
    Forum Moderator
    Posted 4 years ago #

    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.

  8. ronchicago
    Member
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic