Laravel & Php

How to display all categories in WordPress.


How to display all categories in WordPress.
 <?php
    $categories = get_categories( array(
      'orderby' => 'name',
      'order'   => 'ASC'
    ));
    foreach( $categories as $category ) {
?>
  <div class="cat-item px-1 py-3">
     <a class="bg-white rounded d-block p-2 text-center shadow-sm" href="<?php echo esc_url( get_category_link( $category->term_id ) ); ?>">
        <span class="text-center display-4"><i class="fab fa-laravel"></i></span>
        <p class="m-0 small"><?php echo $category->name; ?></p>
     </a>
  </div>
<?php } ?>

WordPress
Share with Friends

Like this chef? Share with friends..