Skip to content

Instantly share code, notes, and snippets.

@theodorocaliari
Created September 27, 2013 19:30
Show Gist options
  • Save theodorocaliari/6733990 to your computer and use it in GitHub Desktop.
Save theodorocaliari/6733990 to your computer and use it in GitHub Desktop.
<div id="colunistas">
<h2>Colunistas</h2>
<ul>
<?php
$teste = array();
// 01
$the_query = new WP_Query('posts_per_page=1');
while ( $the_query->have_posts() ) : $the_query->the_post();
array_push($teste, get_the_author_meta('id')) ?>
<li><?php the_author(); ?> / <?php the_title(); ?></li>
<?php endwhile;
wp_reset_postdata();
// 02
$the_query = new WP_Query('posts_per_page=1&author=-'.$teste[0]);
while ( $the_query->have_posts() ) : $the_query->the_post();
array_push($teste, get_the_author_meta('id')) ?>
<li><?php the_author(); ?> / <?php the_title(); ?></li>
<?php endwhile;
wp_reset_postdata();
// 03
$the_query = new WP_Query('posts_per_page=1&author=-'.$teste[0].',-'.$teste[1]);
while ( $the_query->have_posts() ) : $the_query->the_post();
array_push($teste, get_the_author_meta('id')) ?>
<li><?php the_author(); ?> / <?php the_title(); ?></li>
<?php endwhile;
wp_reset_postdata();
// 04
$the_query = new WP_Query('posts_per_page=1&author=-'.$teste[0].',-'.$teste[1].',-'.$teste[2]);
while ( $the_query->have_posts() ) : $the_query->the_post();
array_push($teste, get_the_author_meta('id')) ?>
<li><?php the_author(); ?> / <?php the_title(); ?></li>
<?php endwhile;
wp_reset_postdata();
?>
</ul>
</div><!-- /#colunistas -->
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment