Paging: Mixed Loop of Custom Post Type & Post Format
-
Hello
I recorded in functions.php:‘post-formats’ :’image’, ‘gallery’,’video’ )
‘post_type’: ‘news’,’review’And ‘post-type’: ‘news’ support ‘post-formats’
I’m trying to do a loop in index.php to list every post with paging (every single standard post, post-format, custom post type and custom post type with post-format). Until now, no success.
Here’s what i’m using
<?php // The Query global $wp_query; query_posts( array_merge( array( 'post_type' => array( 'post', 'Notizia', 'Recensione' ), 'orderby' => 'date', 'order' => 'DESC', 'posts_per_page' => 5 ), $wp_query->query ) ); // The Loop if (have_posts()) : while (have_posts()) : the_post(); // Display Content if( 'notizia' == get_post_type() ) { get_template_part('content-notizia', get_post_format());} elseif( 'recensione' == get_post_type() ) { get_template_part('content', 'recensione');} else { get_template_part('content', get_post_format()); } // End Display Content endwhile; get_pagination(); endif; ?>
I’m sure this loop is wrong 100%
Where’s the error ? 🙂
Thanks
- The topic ‘Paging: Mixed Loop of Custom Post Type & Post Format’ is closed to new replies.