What Is single.php In WordPress

Hello Guys First Take Love From Bottom Of My Heart. Stay Home Stay Safe From #corona. Today’s Episode Is What Is single.php In WordPress. I Am Explaining About WordPress Template File. I Have Already Explained About header.php And footer.php. So Let’s Start.

If You Write A Blog Post In WordPress, All The Content In That Is Controlled By single.php. It Also Called Post Templates File. Index.php, Home.php, Single.php, Singular.php, Archive.php, Author.php, Date.php, Category.php, Tag.php, and Taxonomy.php And Search.php Is Called Post Template. All The File That I Mention Is Used To Make Post. So Single.php Is A Post Template.

Inside single.php You Can Write The Below Code Or Anything That You Want To Show In Your Blog Details Page.

<?php
/**
 * The template for displaying all single posts and attachments
 *
 * @package WordPress
 * @subpackage Twenty_Fifteen
 * @since Twenty Fifteen 1.0
 */
  
get_header(); ?>
  
    <div id="primary" class="content-area">
        <main id="main" class="site-main" role="main">
  
        <?php
        // Start the loop.
        while ( have_posts() ) : the_post();
  
            /*
             * Include the post format-specific template for the content. If you want to
             * use this in a child theme, then include a file called called content-___.php
             * (where ___ is the post format) and that will be used instead.
             */
            get_template_part( 'content', get_post_format() );
  
            // If comments are open or we have at least one comment, load up the comment template.
            if ( comments_open() || get_comments_number() ) :
                comments_template();
            endif;
  
            // Previous/next post navigation.
            the_post_navigation( array(
                'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next', 'twentyfifteen' ) . '</span> ' .
                    '<span class="screen-reader-text">' . __( 'Next post:', 'twentyfifteen' ) . '</span> ' .
                    '<span class="post-title">%title</span>',
                'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous', 'twentyfifteen' ) . '</span> ' .
                    '<span class="screen-reader-text">' . __( 'Previous post:', 'twentyfifteen' ) . '</span> ' .
                    '<span class="post-title">%title</span>',
            ) );
  
        // End the loop.
        endwhile;
        ?>
  
        </main><!-- .site-main -->
    </div><!-- .content-area -->
  
<?php get_footer(); ?>

In The Code There Are Some WordPress Default Function And While Loop. Hope You Guys Knows About While Loop. I Will Break Down All The Function No Tension. Stay With Me. So We Can Say That single.php Contain The Data For Single Post Or The Blog Details Page.

Signing Off. Hope You Guys Enjoy It. Stay Home Stay Safe. Wash Your Hand Protect #corona.

Please follow and like us:

Leave a Comment

Your email address will not be published. Required fields are marked *

RSS
Follow by Email
LinkedIn
Share