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.

I used the following code to create a list of my custom categories and custom post types:

 <ul>           
            <?php
                $custom_terms = get_terms('project_category', 'hide_empty=0');
                foreach($custom_terms as $custom_term) {
                    wp_reset_query();
                        $args = array('post_type' => 'project',
                            'tax_query' => array(
                                array(
                                    'taxonomy' => 'project_category',
                                    'field' => 'slug',
                                    'terms' => $custom_term->slug,
                                ),
                            ),
                        );
                    $loop = new WP_Query($args);
                    if($loop->have_posts()) {
                        echo '<a href="'.get_permalink().'">'.$custom_term->name.'</a>';            
                    while($loop->have_posts()) : $loop->the_post();
                        echo '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
                    endwhile;
                    }
                }
            ?>
        </ul>

What I want to do is to hide the created anchors inside the list and only show them if the parent category is chosen. So I guess I should display them on the category site, and link the list items to the category site.

Can anyone give me a hint please?

share|improve this question
    
You want to make a sort-of accordion menu? –  s_ha_dum Jun 7 '13 at 16:28
    
yes kind of, but i dont want it to work with js. this is the site: 61er.at/project_category/illustration –  Max Jun 7 '13 at 17:01

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.