It is a bizarre one, and perhaps not possible.
I’ve a design the place every class has a sure type within the index. All the things is in a grid in order that one class takes up two columns, one other takes up two rows, and the remaining two one row and one column solely. Works nice till you account for the consumer probably posting 3 occasions in a row in the identical class.
I would like a technique to output the posts so the classes are all the time in the identical place within the grid, no matter different Posts postdates.
<class 1 - most up-to-date submit>
<class 2 - most up-to-date submit>
<class 3 - most up-to-date submit>
<class 4 - most up-to-date submit>
<class 1 - 2nd most up-to-date submit>
<class 2 - 2nd most up-to-date submit>
<class 3 - 2nd most up-to-date submit>
<class 4 - 2nd most up-to-date submit>
and many others.
Any concepts welcome.
UPDATE: per request for code tried. I’ve a clunky begin that is 3 separate queries with offsets, however the resolution would wish to work for an infinite variety of posts. I do know this is not the way in which to go, however hoping a little bit one thing in entrance of me could be much less summary and result in a greater thought.
<?php $cat_terms = get_terms('class');
foreach($cat_terms as $cat_term) {
wp_reset_query();
$catQuery = array(
'post_type' => 'submit',
'posts_per_page' => 1,
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'class',
'area' => 'slug',
'phrases' => $cat_term->slug,
),
),
);
$cat = new WP_Query($catQuery); ?>
<?php if($cat->have_posts()) {
echo '<part class="">';
whereas($cat->have_posts()) : $cat->the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="entry">
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
</part>
<?php } } ?>
<?php wp_reset_query(); ?>
<?php $cat_terms = get_terms('class');
foreach($cat_terms as $cat_term) {
wp_reset_query();
$catQuery = array(
'post_type' => 'submit',
'posts_per_page' => 1,
'offset' => 1,
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'class',
'area' => 'slug',
'phrases' => $cat_term->slug,
),
),
);
$cat = new WP_Query($catQuery); ?>
<?php if($cat->have_posts()) {
echo '<part class="">';
whereas($cat->have_posts()) : $cat->the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="entry">
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
</part>
<?php } } ?>
<?php wp_reset_query(); ?>
<?php $cat_terms = get_terms('class');
foreach($cat_terms as $cat_term) {
wp_reset_query();
$catQuery = array(
'post_type' => 'submit',
'posts_per_page' => 1,
'offset' => 2,
'order' => 'DESC',
'tax_query' => array(
array(
'taxonomy' => 'class',
'area' => 'slug',
'phrases' => $cat_term->slug,
),
),
);
$cat = new WP_Query($catQuery); ?>
<?php if($cat->have_posts()) {
echo '<part class="">';
whereas($cat->have_posts()) : $cat->the_post(); ?>
<div id="post-<?php the_ID(); ?>" class="entry">
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php the_excerpt(); ?>
</div>
<?php endwhile; ?>
</part>
<?php } } ?>
<?php wp_reset_query(); ?>