开发者 |
ghcrows13
NickIronGate |
---|---|
更新时间 | 2015年8月15日 03:28 |
PHP版本: | 3.0.1 及以上 |
WordPress版本: | 4.2.4 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
GreekSort
folder to the /wp-content/plugins/
directoryNo, coding is not required. When a post type is enabled that post type will automatically be sorted.
No. This plugin doesn't run on the front-end of your website.
Enabled post types will be sorted:
Yes, but not much, and the plugin will clean up when it's deactivated or uninstalled. Here's what's added:
Here's an example of how to use Greek Sort in your WP_Query:
<?php $args = array( 'post_type' => 'post', 'orderby' => 'greek_sort', ); $the_query = new WP_Query($args); ?>
or
<?php $args = array( 'post_type' => 'post', 'orderby' => 'title', ); $the_query = new WP_Query($args); ?>
The previous two examples expand to this WP_Query:
<?php $args = array( 'post_type' => 'post', 'meta_key' => 'greek_sort' 'orderby' => 'meta_value_num', ); $the_query = new WP_Query($args); ?>
NOTE: This means you can't use meta_key or meta_compare with greek_sort. If you need to use meta_compare, please consider using meta_query instead.