Skip to content

Instantly share code, notes, and snippets.

@Sstobo
Last active November 8, 2017 19:50
Show Gist options
  • Save Sstobo/21c7569734658260370ae8de2fbae06f to your computer and use it in GitHub Desktop.
Save Sstobo/21c7569734658260370ae8de2fbae06f to your computer and use it in GitHub Desktop.
[wordpress loop] #wp #setup #php
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>
<?php the_posts_navigation(); ?>
<?php else : ?>
<h2>Nothing found!</h2>
<?php endif; ?>
the_title() displays the title of each post
the_permalink() displays the permalink URL for each post
the_ID() displays the ID of each post
the_author() displays the author name for each post
the_content() display the content of the post
These are examples of template tags in WordPress.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment