Skip to content

Instantly share code, notes, and snippets.

@madeinnordeste
Last active August 29, 2015 14:00
Show Gist options
  • Save madeinnordeste/83f2c966607423a22e09 to your computer and use it in GitHub Desktop.
Save madeinnordeste/83f2c966607423a22e09 to your computer and use it in GitHub Desktop.
Wordpress : Strore Query for reuse
<!-- saving the query -->
<?php $temp_query = clone $wp_query; ?>
<!-- listing out featured articles -->
<?php query_posts('category_name=featured&showposts=3'); ?>
<?php while (have_posts()) : the_post(); ?>
<!-- Do special_cat stuff... -->
<?php endwhile; ?>
<!-- restoring the query so it can be later used to display our posts -->
<?php $wp_query = clone $temp_query; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment