Skip to content

Instantly share code, notes, and snippets.

@ashour
Last active February 6, 2019 14:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ashour/90431a7d6f8b2fd69f97f43e6345e4b9 to your computer and use it in GitHub Desktop.
Save ashour/90431a7d6f8b2fd69f97f43e6345e4b9 to your computer and use it in GitHub Desktop.
WordPress theme loop partial - for PhraseApp blog article
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<!-- article -->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- post thumbnail -->
<?php if (has_post_thumbnail()) : ?>
<a
href="<?php the_permalink(); ?>"
title="<?php the_title_attribute(); ?>"
>
<?php the_post_thumbnail(array(120, 120)); ?>
</a>
<?php endif; ?>
<!-- /post thumbnail -->
<!-- post title -->
<h2>
<a
href="<?php the_permalink(); ?>"
title="<?php the_title_attribute(); ?>"
>
<?php the_title(); ?>
</a>
</h2>
<!-- /post title -->
<?php the_content(); ?>
<span class="author">
<?php esc_html_e('Published by', 'handmadestale'); ?>
<?php the_author_posts_link(); ?>
</span>
<!-- /post details -->
<?php edit_post_link(); ?>
</article>
<!-- /article -->
<?php endwhile; ?>
<?php else : ?>
<!-- article -->
<article>
<h2>
<?php esc_html_e('Sorry, nothing to display.', 'handmadestale'); ?>
</h2>
</article>
<!-- /article -->
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment