Skip to content

Instantly share code, notes, and snippets.

@nandomoreirame
Created November 6, 2017 13:00
Show Gist options
  • Save nandomoreirame/835946c9e052a93b648b33374ad32b7e to your computer and use it in GitHub Desktop.
Save nandomoreirame/835946c9e052a93b648b33374ad32b7e to your computer and use it in GitHub Desktop.
<?php
$products_args = array(
'post_type' => 'products',
'posts_per_page' => 10
);
$products_query = new WP_Query($products_args);
?>
<?php if ($products_query->have_posts()): ?>
<?php while ($products_query->have_posts()): $products_query->the_post(); ?>
<article class="entry">
<header class="entry__heading">
<h2 class="entry__title"><?php the_title(); ?></h2>
</header>
<div class="entry__content">
<?php the_content(); ?>
</div>
</article>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_postdata(); // Reset Post Data ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment