Displaying content of single post

  1. Create a file named single.php. This will automatically get all you single posts. For more information about WordPress’ template hierarchy, read the Codex

  2. Inside single.php, run the default loop and get header.php, sidebar.php and footer.php

    <?php get_header(); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
     <?php the_title(); ?>
     <?php the_content(); ?>
     <?php echo get_the_date(); ?>
    
    <?php endwhile; ?>
    <?php endif; ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    

Leave a Comment