|
I don like using categories for this, as they are supposed to be semantic terms. I do, however, like the idea of the global array. Instead of creating a new query directly, I will filter it through a function that will add the results to a global array and return the results:
I add this to functions.php:
function nt_globals($args){ global $used; $defaults = array( 'post__not_in' =>
$used, ); $query = wp_parse_args( $args, $defaults ); $queryObject = new WP_Query($query); foreach ($queryObject->
posts as $item): $used[] = $item->
ID; endforeach; return $queryObject;
}
Then I call the function whenever I want a query:
$queryObject = nt_globals('posts_per_page=1');
while ($queryObject->
have_posts()): $queryObject->
the_post(); the_title();
endwhile;
|