Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Answer to : http://www.reddit.com/r/Wordpress/comments/12k75o/how_would_i_list_10_blog_entries_total_5_of_which/
- */
- $query = new WP_Query( array(
- 'posts_per_page' => 10
- ) );
- if( $query->have_posts() ) {
- $idx = 0;
- while( $query->have_posts() ) {
- $query->the_post();
- if( $idx < 5 ) {
- // Do stuff to display first 5
- printf( '<h2>%s</h2>', get_the_title() );
- the_content();
- } else {
- // Do stuff to display the last 5 (title only)
- printf( '<h2>%s</h2>', get_the_title() );
- }
- idx++;
- }
- }
- wp_reset_postdata();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement