Skip to content

Instantly share code, notes, and snippets.

@Farmatique
Created November 9, 2018 15:39
Show Gist options
  • Save Farmatique/83f6cffa69013e28f01e855be5d07c6a to your computer and use it in GitHub Desktop.
Save Farmatique/83f6cffa69013e28f01e855be5d07c6a to your computer and use it in GitHub Desktop.
Wordpress: custom post type loop
<?php
$args = array( 'post_type' => 'testimonials', 'posts_per_page' => 10 );
$query = new WP_Query( $args );
while ( $query->have_posts() ) : $query->the_post();
?>
<h2> <?php echo the_title(); ?></h2>
<div class="content">
<?php echo the_content(); ?>
</div>
<?php
endwhile;
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment