Displaying content of single post

How I can display content for a single post?
My code:

if (is_single()){
    get_header();
    get_sidebar('left-article');
    render_article();
    get_footer();
}

In render_article I call single_post_title() to get title of post.
However I don’t know how to get time and contents of the post as I can’t find any function like single_post_content() or single_post_time().

4 s
4

  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