Skip to content

Instantly share code, notes, and snippets.

@corenominal
Created January 6, 2016 19:40
Show Gist options
  • Save corenominal/c0d64d2e52a98313309e to your computer and use it in GitHub Desktop.
Save corenominal/c0d64d2e52a98313309e to your computer and use it in GitHub Desktop.
An example WordPress custom loop to show all custom post types.
<?php
// Set-up the loop with all custom post types
$post_types = array( 'post', 'link', 'snippet', 'doodle' );
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => $post_types,
'paged' => $paged,
'posts_per_page' => 10
);
query_posts( $args );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment