Skip to content

Instantly share code, notes, and snippets.

@sanjayatony
Last active November 3, 2020 12:29
Show Gist options
  • Save sanjayatony/730a75056caca6e96603 to your computer and use it in GitHub Desktop.
Save sanjayatony/730a75056caca6e96603 to your computer and use it in GitHub Desktop.
loop custom post type
<?php
$args = array(
'post_type' => 'post',
'posts_per_page' => 4,
'paged' => $paged
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();?>
<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
<span class="date"><?php the_date();?></span>
<?php the_content();?>
<?php endwhile;?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment