Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

cipriano200 on "display only child taxonomies"

$
0
0

Hello guys

This code below displays all TAXONOMY categories with images(CATEGORIES IMAGES PLUGIN).

I don't want to show parent category. This is the only problem

Only to show parent child categories.
ANYONE? PLEASE

<?php $custom_terms = get_terms('parchet-cats');
            //find a way to remove parent (ie show all except for pet-care)
            foreach($custom_terms as $custom_term) {
                wp_reset_query();
                $args = array('post_type' => 'parchet',
                    'tax_query' => array(
                        array(
                            'taxonomy' => 'parchet-cats',
                            'field' => 'slug',
                            'terms' => $custom_term->slug,
                            'operator' => 'AND',
							'parent' => 0,
                        ),
                    ),
                 );

                 $loop = new WP_Query($args);
                 if($loop->have_posts()) {
					echo '<a class="trick product-search-item" href="'.$custom_term->slug.'">';
					echo z_taxonomy_image_url($custom_term->term_id);
                    echo '<h2>'.$custom_term->name.'</h2>';
                    echo '</a>';
                 }
            } 

			?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles