Linux 软件免费装

Sort Query by Post In

开发者 jakemgold
thinkoomph
10up
更新时间 2012年10月21日 03:31
捐献地址: 去捐款
PHP版本: 3.0 及以上
WordPress版本: 3.4.2

标签

order query developer orderby wp query post query

下载

1.1 1.2 1.2.1 1.2.2 1.2.3

详情介绍:

NOTE: This plug-in has been incorporated into WordPress core as of version 3.5. Sort Query by Post In is a very light weight (less than 10 lines of code) plug-in intended for developers executing custom post queries. You're welcome to include it in your theme and redistribute - just offer us some credit, please! When constructing a WordPress post query in your theme template files or plug-in, WordPress offers the option to explicitly specify the posts to retrieve using the post__in parameter. Unfortunately, the orderby parameter does not offer an option that will sort the result by the exact order passed in the post__in parameter. This plug-in adds a post__in option for the orderby parameter that will order the result by the exact order specified in the post__in parameter. And don't worry about the plug-in being deactivated - your post queries with the new post__in value used for orderby will simply gracefully fall back to the default date sorting.

安装:

  1. Install easily with the WordPress plugin control panel or manually download the plugin and upload the extracted folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the 'Plugins' menu in WordPress
  3. Modify the appropriate post queries with the orderby parameter set to post__in
Example query_posts( array( 'post__in' => array(20,10,106), 'orderby' => 'post__in' ) ); That will retrieve posts with IDs 20, 10, and 106 in that order!

升级注意事项:

1.2.3 This plug-in has been folded into WordPress 3.5. If you are running 3.5 or newer, it will self-deactivate. 1.2.1 Do not upgrade if you're using a version of WordPress older than 3.0; support for pre-3.0 has been dropped.

更新日志:

1.2.3 1.2.2 1.2.1 1.2