Title: Sort Query Posts
Author: Tubal
Published: <strong>Ṣẹrẹ 15, 2011</strong>
Last modified: Ọwẹ́wẹ̀  4, 2012

---

Ṣàwárí àwọn plugin

Plugin yìí **kò tíì ṣe àyẹ̀wò pẹ̀lú àwọn ìtújáde mẹ́ta pàtàkì tó kẹ́yìn ti WordPress**.
Ó lè jẹ́ pé a kò tọ́jú tàbí ṣe àtìlẹ́yìn fún un mọ́, ó sì lè ní àwọn ọ̀ràn ìbámu
nígbà tí a bá lò ó pẹ̀lú àwọn ẹ̀yà WordPress tuntun.

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

# Sort Query Posts

 Láti ọwọ́ [Tubal](https://profiles.wordpress.org/tubal/)

[Ṣe ìgbàsílẹ̀](https://downloads.wordpress.org/plugin/sort-query-posts.1.1.zip)

 * [Àwọn àlàyé](https://yor.wordpress.org/plugins/sort-query-posts/#description)
 * [Àwọn àgbéyẹ̀wò](https://yor.wordpress.org/plugins/sort-query-posts/#reviews)
 *  [Ìgbéwọlẹ̀](https://yor.wordpress.org/plugins/sort-query-posts/#installation)
 * [Ìdàgbàsókè](https://yor.wordpress.org/plugins/sort-query-posts/#developers)

 [Ìrànlọ́wọ́](https://wordpress.org/support/plugin/sort-query-posts/)

## Àpèjúwe

A really simple and lightweight plugin (73 lines of code Ìtumọ̀ Yorùbá: – 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).

## Ìgbéwọlẹ̀

 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.

## Àwọn àgbéyẹ̀wò

Kò sí àwọn àgbéyẹ̀wò fún plugin yìí.

## Àwọn Olùkópa & Olùgbéejáde

“Sort Query Posts” jẹ́ ètò ìṣàmúlò orísun ṣíṣí sílẹ̀. Àwọn ènìyàn wọ̀nyí ti ṣe ìkópa
sí plugin yìí.

Àwọn Olùkópa

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

[Túmọ̀ “Sort Query Posts” sí èdè rẹ.](https://translate.wordpress.org/projects/wp-plugins/sort-query-posts)

### Ṣe o nífẹ̀ẹ́ sí ìdàgbàsókè?

[Ṣàwárí koodu](https://plugins.trac.wordpress.org/browser/sort-query-posts/), ṣàyẹ̀wò
[ibi ìpamọ́ SVN](https://plugins.svn.wordpress.org/sort-query-posts/), tàbí ṣe àgbékalẹ̀
sí [àkọsílẹ̀ ìdàgbàsókè](https://plugins.trac.wordpress.org/log/sort-query-posts/)
nípasẹ̀ [RSS](https://plugins.trac.wordpress.org/log/sort-query-posts/?limit=100&mode=stop_on_copy&format=rss).

## Àkọsílẹ̀ àwọn àyípadà

#### 1.1

 * Code refactored for improved performance. Updating is recommended.

## Àkójọpọ̀ Meta

 *  Ẹ̀yà **1.1**
 *  Ìgbàgbọ́hùn tó kẹ́yìn **ọdún 14 sẹ́yìn**
 *  Àwọn ìgbéwọlẹ̀ tó ṣiṣẹ́ **100+**
 *  Ẹ̀yà WordPress ** 2.5 tàbí ju bẹ́ẹ̀ lọ **
 *  Dánwò dé **3.4.2**
 *  Èdè
 * [English (US)](https://wordpress.org/plugins/sort-query-posts/)
 * Àwọn àmì
 * [post](https://yor.wordpress.org/plugins/tags/post/)[query](https://yor.wordpress.org/plugins/tags/query/)
   [reorder](https://yor.wordpress.org/plugins/tags/reorder/)[sort](https://yor.wordpress.org/plugins/tags/sort/)
 *  [Ìwòye Tó Péye](https://yor.wordpress.org/plugins/sort-query-posts/advanced/)

## Àwọn ìbò

 5 lára àwọn ìràwọ̀ 5.

 *  [  3 5-star reviews     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/sort-query-posts/reviews/?filter=2)
 *  [  0 1-star reviews     ](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/)

## Àwọn Olùkópa

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

## Ìrànlọ́wọ́

Nǹkan wà tí o fẹ́ sọ? Ṣé o nílò ìrànlọ́wọ́?

 [Wo àpéjọ ìrànlọ́wọ́](https://wordpress.org/support/plugin/sort-query-posts/)