Last active
September 16, 2016 01:25
-
-
Save jpen365/e9a5754fb6877df033c5bdd25746967c to your computer and use it in GitHub Desktop.
A simple loop
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Note: this loop is a simplified version of a loop published in a post at Elegant Themes | |
// Source: https://www.elegantthemes.com/blog/tips-tricks/converting-html-sites-to-wordpress-sites | |
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> | |
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> | |
<header class="post-header"> | |
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> | |
<p>By <?php the_author_posts_link(); ?>, <?php the_time( 'M j y' ); ?></p> | |
</header> | |
<div class="entry clear"> | |
<?php the_post_thumbnail(); ?> | |
<?php the_content(); ?> | |
</div> | |
<footer class="post-footer"> | |
<div class="comments"><?php comments_popup_link( 'Leave a Comment', '1 Comment', '% Comments' ); ?></div> | |
</footer> | |
</div> | |
<?php endwhile; /* rewind or continue if all posts have been fetched */ ?> | |
<div class="navigation index"> | |
<div class="alignleft"><?php next_posts_link( '← Older' ); ?></div> | |
<div class="alignright"><?php previous_posts_link( 'Newer →' ); ?></div> | |
</div> | |
<?php else : ?> | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment