Title: Sort Query Posts
Author: Tubal
Published: <strong>जनवरी 15, 2011</strong>
Last modified: सेप्टेम्बर 4, 2012

---

प्लगिनहरू खोज्नुहोस्

यो प्लगिन **वर्डप्रेसका ३ प्रमुख नवीनतम रिलीजहरूसँग परीक्षण गरिएको छैन**। यो अब 
सम्भवतः व्यवस्थित वा समर्थन नभएको हुन सक्छ र वर्डप्रेसका नयाँ संस्करणहरूमा प्रयोग
गर्दा अनुकूलता सम्बन्धी समस्या हुन सक्छ।

![](https://s.w.org/plugins/geopattern-icon/sort-query-posts.svg)

# Sort Query Posts

 [Tubal](https://profiles.wordpress.org/tubal/) द्वारा

[डाउनलोड गर्नुहोस्](https://downloads.wordpress.org/plugin/sort-query-posts.1.1.zip)

 * [विवरण](https://ne.wordpress.org/plugins/sort-query-posts/#description)
 * [समीक्षाहरू](https://ne.wordpress.org/plugins/sort-query-posts/#reviews)
 *  [स्थापना](https://ne.wordpress.org/plugins/sort-query-posts/#installation)
 * [विकास](https://ne.wordpress.org/plugins/sort-query-posts/#developers)

 [सहायता](https://wordpress.org/support/plugin/sort-query-posts/)

## विवरण

A really simple and lightweight plugin (73 lines of code – comments included) to
sort posts on-the-fly without making a new query to the database (improves performance).

#### Features:

 * Supports **all `order_by` and `order` values of the [query_posts function](https://codex.wordpress.org/Function_Reference/query_posts#Orderby_Parameters)**
   except `meta_value` and `meta_value_num` (which require a database query).
 * Supports **changing the order of all types of posts**, including custom post 
   type posts and custom post type “archive” posts.

#### Documentation

This plugin adds the function `sort_query_posts_by(string $order_by [, string $order])`
to the global context.
 The second `$order` parameter is optional. Its default value
is `asc` (ascending order).

**Call this function before [the loop](https://codex.wordpress.org/The_Loop) to 
change how posts are ordered.**
 After calling this function you can show the posts
as you normally would.

You can sort posts by:

 * author
 * comment_count
 * date
 * id
 * menu_order
 * modified
 * parent
 * title

This is specially useful in two cases:

 * When you need to reorder the posts returned by the query that WordPress creates
   from your given URL. Custom post type “archive” posts are a great example of 
   this case.
 * When you need the posts returned by your customized query (e.g. `query_posts()`)
   to be shown more than once on the same page and ordered differently.

**Examples:**

    ```
    <?php sort_query_posts_by('title', 'desc'); ?>
    ```

The example above will sort posts by their title in descending order without making
a new query to the database.
 This way sorting is performance friendly.

    ```
    <?php sort_query_posts_by('ID'); ?>
    ```

The example above will sort posts by their ID in ascending order.

    ```
    <?php sort_query_posts_by('rand'); ?>
    ```

The example above will sort posts randomly. When sorting randomly `$order` is ignored.

Plugin developed by Túbal Martín at [www.margenn.com](http://www.margenn.com).

## स्थापना

 1. Upload `sort-query-posts` folder to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress
 3. Use the added function `sort_query_posts_by` after any wordpress query and your
    posts will be sorted to your needs.

## समीक्षाहरू

यस प्लगिनको लागि कुनै समीक्षाहरू छैनन्।

## योगदानकर्ता र डेभलपरहरू

“Sort Query Posts” खुला स्रोत सफ्टवेयर हो। निम्न व्यक्तिहरूले यो प्लगिनमा योगदान
गरेका छन्।

योगदानकर्ताहरू

 *   [ Tubal ](https://profiles.wordpress.org/tubal/)

[“Sort Query Posts” लाई आफ्नो भाषामा अनुवाद गर्नुहोस्](https://translate.wordpress.org/projects/wp-plugins/sort-query-posts)

### विकासमा रुचि छ?

[आरएसएस](https://plugins.trac.wordpress.org/log/sort-query-posts/?limit=100&mode=stop_on_copy&format=rss)
द्वारा [कोड ब्राउज गर्नुहोस्](https://plugins.trac.wordpress.org/browser/sort-query-posts/),
[एसभीएन रिपजिटरी](https://plugins.svn.wordpress.org/sort-query-posts/) हेर्नुहोस्,
वा [विकास लग](https://plugins.trac.wordpress.org/log/sort-query-posts/) को सदस्यता
लिनुहोस्।

## चेन्जलग

#### 1.1

 * Code refactored for improved performance. Updating is recommended.

## मेटा

 *  संस्करण **1.1**
 *  पछिल्लो अपडेट **14 वर्ष अघि**
 *  सक्रिय स्थापना **100+**
 *  वर्डप्रेस संस्करण ** 2.5 वा उच्च **
 *  जाँच गरिएको **3.4.2**
 *  भाषा
 * [English (US)](https://wordpress.org/plugins/sort-query-posts/)
 * ट्यागहरू
 * [post](https://ne.wordpress.org/plugins/tags/post/)[query](https://ne.wordpress.org/plugins/tags/query/)
   [reorder](https://ne.wordpress.org/plugins/tags/reorder/)[sort](https://ne.wordpress.org/plugins/tags/sort/)
 *  [उन्नत दृश्य](https://ne.wordpress.org/plugins/sort-query-posts/advanced/)

## रेटिङ्गहरू

 ५ मा 5 तारा।

 *  [  3 5-तारा समीक्षाहरू     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=5)
 *  [  0 4-तारा समीक्षाहरू     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=4)
 *  [  0 3-तारा समीक्षाहरू     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=3)
 *  [  0 2-तारा समीक्षाहरू     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=2)
 *  [  0 1-तारा समीक्षाहरू     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/sort-query-posts/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/sort-query-posts/reviews/)

## योगदानकर्ताहरू

 *   [ Tubal ](https://profiles.wordpress.org/tubal/)

## सहायता

केही भन्नु छ? सहयोग चाहियो?

 [सहायता फोरम हेर्नुहोस्](https://wordpress.org/support/plugin/sort-query-posts/)