php – Styling a category link

Question

I am still learning but I wasnt able to style a category link. I was able to create the following so only 1 category link is displayed. But I was unsure how I can modify this so I can add a class and style it. Is anyone able to help?

            <?php 
             // category link   
$categories = get_the_category();
        if ( ! empty( $categories ) ) {
echo '<a href="' . esc_url( get_category_link( $categories[0]->term_id ) 
      ) . '">' . esc_html( $categories[0]->name ) . '</a>';
      }
    // category link
         ?>

0
Gmad 2 months 2021-09-23T02:40:02-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse