• This code using taxonomy catgery image plugin to display images for categories .this code display subcategories of main category in parent category page(category.php) . but i want to display only one level of subcategory in the page for example
    hardware (parent category)
    – monitor (first level subcategory of harware)
    – – samsung (second level subcategory)
    – – -lcd (third level subcategory )
    when the user clicks on the hardware link he should see only monitor subcategory link and in second time when he clicks on the monitor he should see the samsung category link and when he click on the samsung the subcategory lcd will displays
    how i should change this code to do my word
    thanks to all
    code :

    <?php
    $cat_id = get_query_var('cat');
    $catlist = get_categories('hide_empty=0&child_of=' . $cat_id);
    echo "<ul>";
    
    foreach($catlist as $categories_item)
    {
    echo '<h1><a href="' . get_category_link( $categories_item->term_id ) . '" title="' . sprintf( __( "View all products in %s" ), $categories_item->name ) . '" ' . '>' . $categories_item->name.'</a> </h1> ';
    
    echo '<div class="categoryoverview clearfix">';
        $terms = apply_filters( 'taxonomy-images-get-terms', '' );
        if ( ! empty( $terms ) ) {
    
          foreach( (array) $terms as $term ) {
            if($term->term_id == $categories_item->term_id) {
               print '<a href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumbnail' );
               echo '</a>';
    
            }
        }
        echo '<p>'. $categories_item->description; echo '</p>';
    }
    echo '</div>';
    }
    echo "</ul>";
    ?>

    [ Please do not bump, that’s not permitted here. If it’s really urgent then consider hiring someone. ]

  • The topic ‘how to display only one level subcategory’ is closed to new replies.