How to display category names on the Blog Page(Post Page)


Hi everyone I hope your doing well, I’m having trouble on how to display the category names on the Post Page or my Blog Page, could anyone give me an idea on how to display the category names.

Here’s how it should look like (the red rectangle is the category names):
enter image description here

Here’s my loop:

<!-- Blog -->
    <div class="common_wrapper">

        <div class="wrapper_100">

                $current_month = null;

                while ( have_posts() ) : the_post();

                $this_year = get_the_date( 'Y' );
                if ( $this_year !== $current_year ) {
                    echo '<h2>' . $this_year . '</h2>';
                $current_year = $this_year;?>
                <a href="<?php echo get_permalink(); ?>">
                    <?php the_date('Y/m/d')?>
                    <?php the_content()?>
            <?php endwhile;?>

Thank You

jricc russel 2 months 0 Answers 9 views 0

Leave an answer