Skip to content

Instantly share code, notes, and snippets.

@garagemwp
Last active June 16, 2018 05:44
Show Gist options
  • Save garagemwp/0e8d84b7ee712edf05b3fe0ceccd8330 to your computer and use it in GitHub Desktop.
Save garagemwp/0e8d84b7ee712edf05b3fe0ceccd8330 to your computer and use it in GitHub Desktop.
Exemplo básico de um loop para exibir os posts recentes no WordPress
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<article <?php post_class(); ?>>
<?php the_title('<h2>','</h2>'); ?>
<p><?php echo get_the_date(); ?></p>
<?php the_post_thumbnail( 'thumbnail' ); ?>
<?php the_excerpt(); ?>
<a href="<?php echo get_permalink(); ?>">Leia mais</a>
</article>
<?php endwhile; ?>
<?php endif; ?>
@garagemwp
Copy link
Author

Exemplo criado para fins didáticos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment