derealty

Запрос

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