Title: Shaun&#039;s WP Query Shortcode
Author: Shaun Scovil
Published: <strong>24 جُون 2012</strong>
Last modified: 20 آڪٽوبر 2012

---

پلگ انس ڳولھيو

ھي پلگ ان **WordPress جي جديد 3 وڏين رليزز** سان آزمايو نه ويو آھي. اهو ٿي سگهي 
ٿو وڌيڪ برقرار يا سپورٽ نه ٿي سگهي ۽ ٿي سگهي ٿو مطابقت جا مسئلا جڏهن ورڈپریس جي 
وڌيڪ تازي ورزن سان استعمال ڪيو وڃي.

![](https://s.w.org/plugins/geopattern-icon/shauns-wp-query-shortcode.svg)

# Shaun's WP Query Shortcode

 کان: [Shaun Scovil](https://profiles.wordpress.org/sscovil/)

[ڊائون لوڊ ڪريو](https://downloads.wordpress.org/plugin/shauns-wp-query-shortcode.zip)

 * [تفصيل](https://snd.wordpress.org/plugins/shauns-wp-query-shortcode/#description)
 * [جائزو](https://snd.wordpress.org/plugins/shauns-wp-query-shortcode/#reviews)
 *  [تنصيب](https://snd.wordpress.org/plugins/shauns-wp-query-shortcode/#installation)
 * [ترقي](https://snd.wordpress.org/plugins/shauns-wp-query-shortcode/#developers)

 [سھائتا](https://wordpress.org/support/plugin/shauns-wp-query-shortcode/)

## وضاحت

Written as a platform for plugin developers, this simple-yet-powerful plugin allows
you to run a custom WP_Query using shortcode, then display the results any way imaginable
using compatible nested shortcodes.

#### How It Works

Add the following shortcode to any WordPress post or page:

    ```
    [wpquery orderby="rand"] [wpq_index] [/wpquery]
    ```

In the example above, the `[wpquery]` shortcode performs a WP_Query using **orderby
=”rand”** to display the results in random order. A full list of query parameters
can be found here: [WP_Query](https://codex.wordpress.org/Class_Reference/WP_Query#Parameters).

Next, the nested `[wpq_index]` shortcode displays the results of the custom WP_Query
as an unordered list of post title links.

#### Why It Rocks

Written as a platform for plugin developers, this simple-yet-powerful plugin allows
developers to write compatible plugins that manipulate the way post data is displayed–
without needing to write functions and shortcode parameters to first retrieve the
post data.

The `[wpq_index]` shortcode function included in this plugin is just a simple example
of what it can do. Any plugin that performs a WP_Query could be rewrtitten and optimized
to work with this plugin, eliminating a lot of unnecessary code.

Best of all, this plugin gives users total control over the WP_Query being performed!

## تصوير

[⌊A basic example of how to use this plugin⌉⌊A basic example of how to use this 
plugin⌉[

A basic example of how to use this plugin

[⌊Code that can be used as a template to write a compatible plugin⌉⌊Code that can
be used as a template to write a compatible plugin⌉[

Code that can be used as a template to write a compatible plugin

## انسٽاليشن

 1. Upload `shauns-wp-query-shortcode.php` to the `/wp-content/plugins/` directory
 2. Activate the plugin through the ‘Plugins’ menu in WordPress
 3. In a post or page, place the nested shortcode: `[wpquery] [wpq_index] [/wpquery]`
 4. Replace `[wpq_index]` with shortcode from any other compatible plugin

## FAQ

  Why did you develop this plugin?

Two of my earlier plugins – [SortTable Post](https://wordpress.org/extend/plugins/sorttable-post/)
and [jqDock Post Thumbs](https://wordpress.org/extend/plugins/jqdock-post-thumbs/)–
essentially did the same thing: They got post data via WP_Query, then used a Javascript
library to display certain information in a unique and interesting way.

Many of the feature requests I received for those plugins came from folks who wanted
more granular control over the data that was retrieved by WP_Query (e.g. only show
posts of a particular category / tag / post-type / taxonomy).

The only way I could accommodate those feature requests was to add more shortcode
parameters to the plugin, but I was also adding shortcode parameters to handle how
the post data was displayed. After a while, things started getting out of hand.

This plugin was the solution.

By separating the shortcode for ‘getting post data’ from the shortcode for ‘displaying
post data’, I was able to simplify the shortcodes for users.

  What shortcode parameters does `[wpquery]` accept?

It accepts all of the same parameters as [WP_Query](https://codex.wordpress.org/Class_Reference/WP_Query#Parameters).

  Where can I find compatible plugins?

Going forward, all of my plugins that use WP_Query will require this plugin to be
installed. You can find my plugins here: [Shaun’s Profile](https://profiles.wordpress.org/sscovil)

To find compatible plugins written by other authors, try searching the WP Plugin
Repository for “Shaun’s WP Query Shortcode”.

If you’re real savvy, you can even write your own compatible plugins! Just use the`
mnsp_wpq_index` function that comes with this plugin as a template…and if you upload
it to the repository, make sure you let people know that it requires Shaun’s WP 
Query Shortcode to work!

  How can I request support or report a bug?

Please post your question as a comment on the apporpriate plugin page of my website:
[MyNewSitePreview.com](http://mnsp.co/)

## جائزا

ھن پلگ ان لاءِ ڪي به رايا ناھن.

## تعاون ڪندڙ & ڊولپرز

“Shaun's WP Query Shortcode” اوپن سورس سافٽ ويئر آهي. ھيٺين ماڻھن ھن پلگ ان ۾ حصو
ورتو آھي.

تعاون ڪندڙ

 *   [ Shaun Scovil ](https://profiles.wordpress.org/sscovil/)

[ترجمو ڪريو “Shaun's WP Query Shortcode” توهان جي ٻولي ۾.](https://translate.wordpress.org/projects/wp-plugins/shauns-wp-query-shortcode)

### ڊولپمينٽ ۾ دلچسپي؟

[ڪوڊ براؤز ڪريو](https://plugins.trac.wordpress.org/browser/shauns-wp-query-shortcode/)،
چيڪ ڪريو [SVN مخزن](https://plugins.svn.wordpress.org/shauns-wp-query-shortcode/)،
يا رڪنيت حاصل ڪريو [ڊولپمينٽ لاگ](https://plugins.trac.wordpress.org/log/shauns-wp-query-shortcode/)
پاران [RSS](https://plugins.trac.wordpress.org/log/shauns-wp-query-shortcode/?limit=100&mode=stop_on_copy&format=rss).

## لاگ تبدیل ڪريو

#### 1.2

 * Modified the `wpq_index` shortcode function to exclude the current post/page 
   from the list.

#### 1.1

 * Added function to detect array expressions in shortcode parameters and convert
   them to arrays. This allows you to set WP_Query parameters such as `category__and`,`
   category__in`, `category__not_in`, etc.
 * Thanks to [Netcoder](http://stackoverflow.com/users/492901/netcoder) for providing
   this [solution](http://stackoverflow.com/questions/11267434/php-how-to-turn-a-string-that-contains-an-array-expression-in-an-actual-array/11267511#comment14814921_11267511)!

#### 1.0

 * First public release.

## ميٽا

 *  Version **1.2**
 *  Last updated **14 سالَ اڳ**
 *  Active installations **10+**
 *  WordPress version ** 3.0 يا وڌيڪ **
 *  Tested up to **3.4.2**
 *  Language
 * [English (US)](https://wordpress.org/plugins/shauns-wp-query-shortcode/)
 * Tags
 * [custom](https://snd.wordpress.org/plugins/tags/custom/)[page](https://snd.wordpress.org/plugins/tags/page/)
   [post](https://snd.wordpress.org/plugins/tags/post/)[query](https://snd.wordpress.org/plugins/tags/query/)
   [type](https://snd.wordpress.org/plugins/tags/type/)
 *  [ترقي يافته ڏيک](https://snd.wordpress.org/plugins/shauns-wp-query-shortcode/advanced/)

## درجه بندي

 5 out of 5 stars.

 *  [  1 5-star review     ](https://wordpress.org/support/plugin/shauns-wp-query-shortcode/reviews/?filter=5)
 *  [  0 4-star reviews     ](https://wordpress.org/support/plugin/shauns-wp-query-shortcode/reviews/?filter=4)
 *  [  0 3-star reviews     ](https://wordpress.org/support/plugin/shauns-wp-query-shortcode/reviews/?filter=3)
 *  [  0 2-star reviews     ](https://wordpress.org/support/plugin/shauns-wp-query-shortcode/reviews/?filter=2)
 *  [  0 1-star reviews     ](https://wordpress.org/support/plugin/shauns-wp-query-shortcode/reviews/?filter=1)

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

[See all reviews](https://wordpress.org/support/plugin/shauns-wp-query-shortcode/reviews/)

## تعاون ڪندڙ

 *   [ Shaun Scovil ](https://profiles.wordpress.org/sscovil/)

## سھائتا

چوڻ لاءِ ڪجهه آهي؟ مدد گهرجي؟

 [ڏسو سپورٽ فورم](https://wordpress.org/support/plugin/shauns-wp-query-shortcode/)

## عطيو

ڇا توھان ھن پلگ ان جي ترقي ۾ مدد ڪرڻ چاھيو ٿا؟

 [ هن پلگ ان ڏانھن مدد ڪريو ](http://mynewsitepreview.com/donate/)