Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $term_id = get_queried_object()->term_id;
- $taxonomy_name = get_query_var( 'cat' );
- $termchildren = get_term_children( $term_id, $taxonomy_name );
- // Loop through each child taxonomy term
- foreach ( $termchildren as $child ) {
- // Get the term object
- $term = get_term_by( 'id', $child, $taxonomy_name );
- // Get the values we need to output
- $url = get_term_link( $child, $taxonomy_name );
- $name = $term->name;
- // We make the call here to get the image and we pass in the term we want the image for
- $image = get_field('kategorija_slika', $term );
- // Output it all
- echo '<div class="col-sm-4 sub-caregory">';
- echo '<a href="' . $url . '">' . $name . '</a><div class="sub-caregory-image"><img src="' . esc_url($image['url']) . '" alt="' . esc_attr($image['alt']) . '" /></div>';
- echo '</div>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement