wordpress-theme / single.php
single.php
Raw
<?php get_header(); ?>
    <article class='single-post'>
            <br> 
            <?php
            if( have_posts()){
                while( have_posts()) {
                    the_post();
                    ?>
                    
                    <!-- add return btn to category -->
                    <?php
                    $get_cat        = get_the_category();
                    $first_cat      = $get_cat[0];
                    $category_name  = $first_cat->cat_name;
                    $category_link  = get_category_link( $first_cat->cat_ID ); ?>
                    <a class='back-btn' href="<?php echo esc_url( $category_link ); ?>" title="<?php echo esc_attr( $category_name ); ?>"><i class="fa fa-thin fa-backward"></i> </a>
                    <?php

                    if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
                    $thumbnail_url = get_the_post_thumbnail_url('', 'post-thumbnails');    
                    } 
                    ?>
                    <img  src='<?php echo $thumbnail_url; ?>'>
                    <div class="singel-heading"> <?php  the_title(); ?> </div> <br>
                    <div  class="singel-para">  <?php the_content(); ?> </div>
                    <br>
                    </p>
                    <?php 
                }
            } ?>
    </article>
    <?php get_footer(); ?>