Linux 软件免费装

Plugin Name

开发者 Tubal
更新时间 2012年9月4日 20:11
PHP版本: 2.5 及以上
WordPress版本: 3.4

标签

post order query reorder sort order_by

下载

1.0 1.1

详情介绍:

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: 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 to change how posts are ordered. After calling this function you can show the posts as you normally would. You can sort posts by: This is specially useful in two cases: 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.

安装:

  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.

更新日志:

1.1