The design parameters have changes slightly. I have come up with a solution that is working to show:
1 full width news item
3 news with excerpt
1 full width music item
16 music items with image and title
3 posts from a misc category
3 posts from a different misc category
For the content in each section I am using- get_template_part.
Here's what is working:
Start with one loop to show the 1st full width news item:
<?php
$args=array(
'post_type' => 'dt_portfolio',
'taxonomy' => 'dt_portfolio_category',
'term' => 'news',
'posts_per_page' => 1
);
$fullnewsloop = new WP_Query($args);
if($fullnewsloop->have_posts()) : while($fullnewsloop->have_posts()) :
$fullnewsloop->the_post();
get_template_part( 'content-full-width', get_post_format() );
endwhile; endif; ?>
Use a second loop to show the next 3 news items. Offset is the key for skipping the first news item that has already been displayed in the fullnewsloop
.
<?php
$args=array(
'post_type' => 'dt_portfolio',
'taxonomy' => 'dt_portfolio_category',
'term' => 'news',
'posts_per_page' => 3,
'offset' => 1 // this skips the first post from the news category.
);
$shortnewsloop = new WP_Query($args);
if($shortnewsloop->have_posts()) : while($shortnewsloop->have_posts()) :
$shortnewsloop->the_post();
get_template_part( 'content-title-excerpt', get_post_format() );
endwhile; endif; ?>
The next section recycles the above loops using different taxonomy terms.
<?php
$args=array (
'post_type' => 'dt_portfolio',
'taxonomy' => 'dt_portfolio_category',
'term' => 'music',
'posts_per_page' => 1
);
$fullmusicloop = new WP_Query($args);
if($fullmusicloop->have_posts()) : while($fullmusicloop->have_posts()) :
$fullmusicloop->the_post();
get_template_part( 'content-full-width', get_post_format() );
endwhile; endif; ?>
<?php
$args=array(
'post_type' => 'dt_portfolio',
'taxonomy' => 'dt_portfolio_category',
'term' => 'music',
'posts_per_page' => 16,
'offset' => 1 // this skips the post already displayed in the fullmusicloop.
);
$shortmusicloop = new WP_Query($args);
if($shortmusicloop->have_posts()) : while($shortmusicloop->have_posts()) :
$shortmusicloop->the_post();
get_template_part( 'content-title-image', get_post_format() );
endwhile; endif; ?>
The last section is two more loops from taxonomy terms.
<?php
$args=array(
'post_type' => 'dt_portfolio',
'taxonomy' => 'dt_portfolio_category',
'term' => 'speakerss',
'posts_per_page' => 3,
);
$speakersloop = new WP_Query($args);
if($speakersloop->have_posts()) : while($speakersloop->have_posts()) :
$speakersloop->the_post();
get_template_part( 'content-title-image', get_post_format() );
endwhile; endif; ?>
<?php
$args=array(
'post_type' => 'dt_portfolio',
'taxonomy' => 'dt_portfolio_category',
'term' => 'artists',
'posts_per_page' => 3,
);
$artistsloop = new WP_Query($args);
if($artistsloop->have_posts()) : while($artistsloop->have_posts()) :
$artistsloop->the_post();
get_template_part( 'content-title-image', get_post_format() );
endwhile; endif; ?>