derealty

Untitled

Apr 30th, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.60 KB | None | 0 0
  1.             <?php
  2.             $terms = get_terms(
  3.               array(
  4.                 'taxonomy'   => 'data',
  5.                 'hide_empty' => true,
  6.                 'pad_counts'  => true,
  7.                 'orderby' => 'count',
  8.                 'order' => 'DESC',
  9.               )
  10.             );
  11.              
  12.             if ( ! empty( $terms ) && is_array( $terms ) ) {
  13.               echo '<div class="row">';
  14.               foreach ( $terms as $term ) { ?>
  15.                 <div class="col-xl-2 col-6">
  16.                   <a class="btn btn-outline-dark w-100" href="<?php echo esc_url( get_term_link( $term ) ) ?>">
  17.                     <?php echo $term->name; ?>
  18.                   </a>
  19.                 </div>
  20.                 <?php
  21.               }
  22.               echo '</div>';
  23.             }
  24.             ?>  
Advertisement
Add Comment
Please, Sign In to add comment