WordPress Posts

Beginner
7 min read
Updated: Nov 2026
2 examples
Core concept

Definition

A post is the main kind of content in WordPress, such as a blog article. Each post has a title, text, a date, and often categories and tags. You write posts in the admin, and your theme decides how they look.

A theme shows posts with The Loop. The Loop goes through the posts for the page, and inside it you call template tags such as the_title() and the_content().

Remember.

Most the_* tags work on the current post, so they need The Loop. Call the_post() first, and then print what you need.

The Loop

This is the shape of almost every theme template.

WordPress
<?php
if ( have_posts() ) :
  while ( have_posts() ) : the_post();
    // template tags go here
  endwhile;
endif;

have_posts() asks if there are posts left. the_post() moves to the next post and sets it as the current one.

Common Tags in Your Templates

These are the tags you will use most.

Watch the plural: next_post_link() moves between single posts, while next_posts_link() moves between pages of a list.

WordPress Examples

Two short examples with sample output.

Example 1 — Show a title and the content

Use The Loop and two tags to build a simple post page.

WordPress
<?php while ( have_posts() ) : the_post(); ?>
  <article>
    <?php the_title( '<h1>', '</h1>' ); ?>
    <?php the_content(); ?>
  </article>
<?php endwhile; ?>

How It Works

  1. the_post() sets the current post for the tags below it.
  2. the_title() prints the title inside an h1.
  3. the_content() prints the post body.

Example 2 — Show the date safely

Use get_the_date() because it returns the date, and then escape it.

WordPress
<?php while ( have_posts() ) : the_post(); ?>
  <p>
    Published on
    <?php echo esc_html( get_the_date( 'F j, Y' ) ); ?>
  </p>
<?php endwhile; ?>

How It Works

  1. get_the_date( 'F j, Y' ) returns the date as text.
  2. esc_html() makes the text safe to print.
  3. Unlike the_date(), it shows the date for every post, even on the same day.

Next: WordPress Post Functions

Now that you know the basics, open the functions index for all 43 guides.

Full list: WordPress Post Functions index (/wordpress/post/function).

Frequently Asked Questions

A post is a piece of content you write in the editor, such as a blog article. It has a title, content, date, categories, and tags.
The Loop is the PHP code that goes through the posts for the current page. Inside it you call tags like the_title() and the_content().
the_title() prints the title. get_the_title() returns it, so you can store it or change it. Escape it with esc_html() when you print it.
single.php. The blog list and archives use index.php and archive.php.
Most the_* tags do, because they work on the current post. Some, like get_the_title( 12 ), also work with a post ID.
Open the WordPress Post Functions index. It lists all 43 guides in short tables.

Browse every post function

Open the functions index for simple guides with examples and FAQs.

Post Functions Index →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful