Skip to content

Instantly share code, notes, and snippets.

@ShahinAhmed7
Created August 10, 2017 18:06
Show Gist options
  • Save ShahinAhmed7/b1af0e328b3d1003702a7f9dd37e112a to your computer and use it in GitHub Desktop.
Save ShahinAhmed7/b1af0e328b3d1003702a7f9dd37e112a to your computer and use it in GitHub Desktop.
$secondary_query = new WP_Query( 'category_name=example-category' );
// The second loop. if ( $secondary_query->have_posts() )
echo '<ul>';
while ( $secondary_query->have_posts() ) :
$secondary_query->the_post();
echo '<li>' . get_the_title() . '</li>';
endwhile;
echo '</ul>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment