Title: order posts with two loops
Last modified: August 24, 2016

---

# order posts with two loops

 *  [legendsacrifice](https://wordpress.org/support/users/legendsacrifice/)
 * (@legendsacrifice)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/order-posts-with-two-loops/)
 * hi guys
    i create two tabs for each category tab-1: order posts in category by
   date .. tab-2: order posts by post_views_count i try this code but the probleme#
   page 2 witch dublicate the same result of the first page for both tab .. note:
   i put the loop in loop.php
 *     ```
       <div id="tabcontent">
           <div class="tab-content">
               <div class="tabsPosts">
                   <?$categoryvariable = $cat;
                   $args = array(
                   'cat'        => $categoryvariable,
                   );
                   query_posts( $args );?>
                   <?php require TEMPLATEPATH . '/loop.php';?>
       		</div>
       	</div>
           <div class="tab-content" id="tab-2">
               <div class="tabsPosts">
                   <?$categoryvariable = $cat;
                   $args = array(
       	        'cat'            => $categoryvariable,
                   'meta_key'      => 'post_views_count',
       	        'orderby'        =>'meta_value_num',
       	        'order'          => 'Desc',
                   );
                   query_posts( $args );?>
                   <?php require TEMPLATEPATH . '/loop.php';?>
               </div>
           </div>
       </div>
       ```
   
 * so can any one help me with this

Viewing 1 replies (of 1 total)

 *  Thread Starter [legendsacrifice](https://wordpress.org/support/users/legendsacrifice/)
 * (@legendsacrifice)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/order-posts-with-two-loops/#post-6013859)
 * keep waiting ..

Viewing 1 replies (of 1 total)

The topic ‘order posts with two loops’ is closed to new replies.

## Tags

 * [two loops](https://wordpress.org/support/topic-tag/two-loops/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [legendsacrifice](https://wordpress.org/support/users/legendsacrifice/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/order-posts-with-two-loops/#post-6013859)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
