Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The design parameters have changes slightly. I have come up with a solution that is working to show:</p> <p>1 full width news item </p> <p>3 news with excerpt</p> <p>1 full width music item</p> <p>16 music items with image and title</p> <p>3 posts from a misc category</p> <p>3 posts from a different misc category</p> <p>For the content in each section I am using- get_template_part. </p> <p>Here's what is working:</p> <p>Start with one loop to show the 1st full width news item:</p> <pre><code>&lt;?php $args=array( 'post_type' =&gt; 'dt_portfolio', 'taxonomy' =&gt; 'dt_portfolio_category', 'term' =&gt; 'news', 'posts_per_page' =&gt; 1 ); $fullnewsloop = new WP_Query($args); if($fullnewsloop-&gt;have_posts()) : while($fullnewsloop-&gt;have_posts()) : $fullnewsloop-&gt;the_post(); get_template_part( 'content-full-width', get_post_format() ); endwhile; endif; ?&gt; </code></pre> <p>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 <code>fullnewsloop</code>.</p> <pre><code>&lt;?php $args=array( 'post_type' =&gt; 'dt_portfolio', 'taxonomy' =&gt; 'dt_portfolio_category', 'term' =&gt; 'news', 'posts_per_page' =&gt; 3, 'offset' =&gt; 1 // this skips the first post from the news category. ); $shortnewsloop = new WP_Query($args); if($shortnewsloop-&gt;have_posts()) : while($shortnewsloop-&gt;have_posts()) : $shortnewsloop-&gt;the_post(); get_template_part( 'content-title-excerpt', get_post_format() ); endwhile; endif; ?&gt; </code></pre> <p>The next section recycles the above loops using different taxonomy terms.</p> <pre><code>&lt;?php $args=array ( 'post_type' =&gt; 'dt_portfolio', 'taxonomy' =&gt; 'dt_portfolio_category', 'term' =&gt; 'music', 'posts_per_page' =&gt; 1 ); $fullmusicloop = new WP_Query($args); if($fullmusicloop-&gt;have_posts()) : while($fullmusicloop-&gt;have_posts()) : $fullmusicloop-&gt;the_post(); get_template_part( 'content-full-width', get_post_format() ); endwhile; endif; ?&gt; &lt;?php $args=array( 'post_type' =&gt; 'dt_portfolio', 'taxonomy' =&gt; 'dt_portfolio_category', 'term' =&gt; 'music', 'posts_per_page' =&gt; 16, 'offset' =&gt; 1 // this skips the post already displayed in the fullmusicloop. ); $shortmusicloop = new WP_Query($args); if($shortmusicloop-&gt;have_posts()) : while($shortmusicloop-&gt;have_posts()) : $shortmusicloop-&gt;the_post(); get_template_part( 'content-title-image', get_post_format() ); endwhile; endif; ?&gt; </code></pre> <p>The last section is two more loops from taxonomy terms.</p> <pre><code>&lt;?php $args=array( 'post_type' =&gt; 'dt_portfolio', 'taxonomy' =&gt; 'dt_portfolio_category', 'term' =&gt; 'speakerss', 'posts_per_page' =&gt; 3, ); $speakersloop = new WP_Query($args); if($speakersloop-&gt;have_posts()) : while($speakersloop-&gt;have_posts()) : $speakersloop-&gt;the_post(); get_template_part( 'content-title-image', get_post_format() ); endwhile; endif; ?&gt; &lt;?php $args=array( 'post_type' =&gt; 'dt_portfolio', 'taxonomy' =&gt; 'dt_portfolio_category', 'term' =&gt; 'artists', 'posts_per_page' =&gt; 3, ); $artistsloop = new WP_Query($args); if($artistsloop-&gt;have_posts()) : while($artistsloop-&gt;have_posts()) : $artistsloop-&gt;the_post(); get_template_part( 'content-title-image', get_post_format() ); endwhile; endif; ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload