Post Types Order - Version 1.7.7

Version Description

  • Next / Previous post link functionality update
    • Code improvements
    • Norvegian translation update - Bjorn Johansen bjornjohansen.no
    • Czech translation - dUDLAJ; Martin Kucera - http://jsemweb.cz/
Download this release

Release Info

Developer nsp-code
Plugin Icon 128x128 Post Types Order
Version 1.7.7
Comparing to
See all releases

Code changes from version 1.7.4 to 1.7.7

include/cpto-class.php ADDED
@@ -0,0 +1,241 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class CPTO
4
+ {
5
+ var $current_post_type = null;
6
+
7
+ function CPTO()
8
+ {
9
+ add_action( 'admin_init', array(&$this, 'registerFiles'), 11 );
10
+ add_action( 'admin_init', array(&$this, 'checkPost'), 10 );
11
+ add_action( 'admin_menu', array(&$this, 'addMenu') );
12
+
13
+
14
+
15
+ add_action( 'wp_ajax_update-custom-type-order', array(&$this, 'saveAjaxOrder') );
16
+ }
17
+
18
+ function registerFiles()
19
+ {
20
+ if ( $this->current_post_type != null )
21
+ {
22
+ wp_enqueue_script('jQuery');
23
+ wp_enqueue_script('jquery-ui-sortable');
24
+ }
25
+
26
+ wp_register_style('CPTStyleSheets', CPTURL . '/css/cpt.css');
27
+ wp_enqueue_style( 'CPTStyleSheets');
28
+ }
29
+
30
+ function checkPost()
31
+ {
32
+ if ( isset($_GET['page']) && substr($_GET['page'], 0, 17) == 'order-post-types-' )
33
+ {
34
+ $this->current_post_type = get_post_type_object(str_replace( 'order-post-types-', '', $_GET['page'] ));
35
+ if ( $this->current_post_type == null)
36
+ {
37
+ wp_die('Invalid post type');
38
+ }
39
+ }
40
+ }
41
+
42
+ function saveAjaxOrder()
43
+ {
44
+ global $wpdb;
45
+
46
+ parse_str($_POST['order'], $data);
47
+
48
+ if (is_array($data))
49
+ foreach($data as $key => $values )
50
+ {
51
+ if ( $key == 'item' )
52
+ {
53
+ foreach( $values as $position => $id )
54
+ {
55
+ $data = array('menu_order' => $position, 'post_parent' => 0);
56
+ $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
57
+
58
+ $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
59
+ }
60
+ }
61
+ else
62
+ {
63
+ foreach( $values as $position => $id )
64
+ {
65
+ $data = array('menu_order' => $position, 'post_parent' => str_replace('item_', '', $key));
66
+ $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
67
+
68
+ $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
69
+ }
70
+ }
71
+ }
72
+ }
73
+
74
+
75
+ function addMenu()
76
+ {
77
+ global $userdata;
78
+ //put a menu for all custom_type
79
+ $post_types = get_post_types();
80
+
81
+ $options = get_option('cpto_options');
82
+ //get the required user capability
83
+ $capability = '';
84
+ if(isset($options['capability']) && !empty($options['capability']))
85
+ {
86
+ $capability = $options['capability'];
87
+ }
88
+ else if (is_numeric($options['level']))
89
+ {
90
+ $capability = userdata_get_user_level();
91
+ }
92
+ else
93
+ {
94
+ $capability = 'install_plugins';
95
+ }
96
+
97
+ foreach( $post_types as $post_type_name )
98
+ {
99
+ if ($post_type_name == 'page')
100
+ continue;
101
+
102
+ //ignore bbpress
103
+ if ($post_type_name == 'reply' || $post_type_name == 'topic')
104
+ continue;
105
+
106
+ if ($post_type_name == 'post')
107
+ add_submenu_page('edit.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
108
+ else
109
+ {
110
+ if (!is_post_type_hierarchical($post_type_name))
111
+ add_submenu_page('edit.php?post_type='.$post_type_name, __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
112
+ }
113
+ }
114
+ }
115
+
116
+
117
+ function SortPage()
118
+ {
119
+ ?>
120
+ <div class="wrap">
121
+ <div class="icon32" id="icon-edit"><br></div>
122
+ <h2><?php echo $this->current_post_type->labels->singular_name . ' - '. __('Re-Order', 'cpt') ?></h2>
123
+
124
+ <?php cpt_info_box(); ?>
125
+
126
+ <div id="ajax-response"></div>
127
+
128
+ <noscript>
129
+ <div class="error message">
130
+ <p><?php _e('This plugin can\'t work without javascript, because it\'s use drag and drop and AJAX.', 'cpt') ?></p>
131
+ </div>
132
+ </noscript>
133
+
134
+ <div id="order-post-type">
135
+ <ul id="sortable">
136
+ <?php $this->listPages('hide_empty=0&title_li=&post_type='.$this->current_post_type->name); ?>
137
+ </ul>
138
+
139
+ <div class="clear"></div>
140
+ </div>
141
+
142
+ <p class="submit">
143
+ <a href="javascript: void(0)" id="save-order" class="button-primary"><?php _e('Update', 'cpt' ) ?></a>
144
+ </p>
145
+
146
+ <script type="text/javascript">
147
+ jQuery(document).ready(function() {
148
+ jQuery("#sortable").sortable({
149
+ 'tolerance':'intersect',
150
+ 'cursor':'pointer',
151
+ 'items':'li',
152
+ 'placeholder':'placeholder',
153
+ 'nested': 'ul'
154
+ });
155
+
156
+ jQuery("#sortable").disableSelection();
157
+ jQuery("#save-order").bind( "click", function() {
158
+
159
+ jQuery("html, body").animate({ scrollTop: 0 }, "fast");
160
+
161
+ jQuery.post( ajaxurl, { action:'update-custom-type-order', order:jQuery("#sortable").sortable("serialize") }, function() {
162
+ jQuery("#ajax-response").html('<div class="message updated fade"><p><?php _e('Items Order Updated', 'cpt') ?></p></div>');
163
+ jQuery("#ajax-response div").delay(3000).hide("slow");
164
+ });
165
+ });
166
+ });
167
+ </script>
168
+
169
+ </div>
170
+ <?php
171
+ }
172
+
173
+ function listPages($args = '')
174
+ {
175
+ $defaults = array(
176
+ 'depth' => 0, 'show_date' => '',
177
+ 'date_format' => get_option('date_format'),
178
+ 'child_of' => 0, 'exclude' => '',
179
+ 'title_li' => __('Pages'), 'echo' => 1,
180
+ 'authors' => '', 'sort_column' => 'menu_order',
181
+ 'link_before' => '', 'link_after' => '', 'walker' => ''
182
+ );
183
+
184
+ $r = wp_parse_args( $args, $defaults );
185
+ extract( $r, EXTR_SKIP );
186
+
187
+ $output = '';
188
+
189
+ $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']);
190
+ $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array();
191
+ $r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', $exclude_array) );
192
+
193
+ // Query pages.
194
+ $r['hierarchical'] = 0;
195
+ $args = array(
196
+ 'sort_column' => 'menu_order',
197
+ 'post_type' => $post_type,
198
+ 'posts_per_page' => -1,
199
+ 'orderby' => array(
200
+ 'menu_order' => 'ASC',
201
+ 'post_date' => 'DESC'
202
+ )
203
+ );
204
+
205
+ $the_query = new WP_Query($args);
206
+ $pages = $the_query->posts;
207
+
208
+ if ( !empty($pages) ) {
209
+ if ( $r['title_li'] )
210
+ $output .= '<li class="pagenav intersect">' . $r['title_li'] . '<ul>';
211
+
212
+ $output .= $this->walkTree($pages, $r['depth'], $r);
213
+
214
+ if ( $r['title_li'] )
215
+ $output .= '</ul></li>';
216
+ }
217
+
218
+ $output = apply_filters('wp_list_pages', $output, $r);
219
+
220
+ if ( $r['echo'] )
221
+ echo $output;
222
+ else
223
+ return $output;
224
+ }
225
+
226
+ function walkTree($pages, $depth, $r)
227
+ {
228
+ if ( empty($r['walker']) )
229
+ $walker = new Post_Types_Order_Walker;
230
+ else
231
+ $walker = $r['walker'];
232
+
233
+ $args = array($pages, $depth, $r);
234
+ return call_user_func_array(array(&$walker, 'walk'), $args);
235
+ }
236
+ }
237
+
238
+
239
+
240
+
241
+ ?>
include/functions.php CHANGED
@@ -64,7 +64,7 @@
64
 
65
  <p><?php _e('Did you find this plugin useful? Please support our work with a donation or write an article about this plugin in your blog with a link to our site', 'cpt') ?> <a href="http://www.nsp-code.com/" target="_blank"><strong>http://www.nsp-code.com/</strong></a>.</p>
66
  <h4><?php _e('Did you know there is available an Advanced version of this plug-in?', 'cpt') ?> <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/"><?php _e('Read more', 'cpt') ?></a></h4>
67
- <p><?php _e('Check our', 'cpt') ?> <a target="_blank" href="http://wordpress.org/extend/plugins/taxonomy-terms-order/">Category Order - Taxonomy Terms Order</a> <?php _e('plugin which allow to custom sort categories and custom taxonomies terms', 'cpt') ?> </p>
68
 
69
  <div class="clear"></div>
70
  </div>
64
 
65
  <p><?php _e('Did you find this plugin useful? Please support our work with a donation or write an article about this plugin in your blog with a link to our site', 'cpt') ?> <a href="http://www.nsp-code.com/" target="_blank"><strong>http://www.nsp-code.com/</strong></a>.</p>
66
  <h4><?php _e('Did you know there is available an Advanced version of this plug-in?', 'cpt') ?> <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/"><?php _e('Read more', 'cpt') ?></a></h4>
67
+ <p><?php _e('Check our', 'cpt') ?> <a target="_blank" href="http://wordpress.org/plugins/taxonomy-terms-order/">Category Order - Taxonomy Terms Order</a> <?php _e('plugin which allow to custom sort categories and custom taxonomies terms', 'cpt') ?> </p>
68
 
69
  <div class="clear"></div>
70
  </div>
include/walkers.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Post_Types_Order_Walker extends Walker
4
+ {
5
+
6
+ var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
7
+
8
+
9
+ function start_lvl(&$output, $depth = 0, $args = array()) {
10
+ $indent = str_repeat("\t", $depth);
11
+ $output .= "\n$indent<ul class='children'>\n";
12
+ }
13
+
14
+
15
+ function end_lvl(&$output, $depth = 0, $args = array()) {
16
+ $indent = str_repeat("\t", $depth);
17
+ $output .= "$indent</ul>\n";
18
+ }
19
+
20
+
21
+ function start_el(&$output, $page, $depth = 0, $args = array(), $id = 0) {
22
+ if ( $depth )
23
+ $indent = str_repeat("\t", $depth);
24
+ else
25
+ $indent = '';
26
+
27
+ extract($args, EXTR_SKIP);
28
+
29
+ $output .= $indent . '<li id="item_'.$page->ID.'"><span>'.apply_filters( 'the_title', $page->post_title, $page->ID ).'</span>';
30
+ }
31
+
32
+
33
+ function end_el(&$output, $page, $depth = 0, $args = array()) {
34
+ $output .= "</li>\n";
35
+ }
36
+
37
+ }
38
+
39
+
40
+
41
+ ?>
lang/cpt-cs_CZ.mo ADDED
Binary file
lang/cpt-cs_CZ.po ADDED
@@ -0,0 +1,201 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Post Types Order v1.7.4\n"
4
+ "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: \n"
6
+ "PO-Revision-Date: 2014-09-15 00:41+0100\n"
7
+ "Last-Translator: Jaroslav Ondra <ondrajaroslav@gmail.com>\n"
8
+ "Language-Team: dudlajda <ondrajaroslav@gmail.com>\n"
9
+ "MIME-Version: 1.0\n"
10
+ "Content-Type: text/plain; charset=UTF-8\n"
11
+ "Content-Transfer-Encoding: 8bit\n"
12
+ "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n"
13
+ "X-Generator: Poedit 1.6.9\n"
14
+ "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
16
+ "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
17
+ "X-Poedit-Basepath: ../\n"
18
+ "X-Textdomain-Support: yes\n"
19
+ "Language: cs_CZ\n"
20
+ "X-Poedit-SearchPath-0: .\n"
21
+
22
+ # @ cpt
23
+ #: include/functions.php:65
24
+ msgid ""
25
+ "Did you find this plugin useful? Please support our work with a donation or "
26
+ "write an article about this plugin in your blog with a link to our site"
27
+ msgstr ""
28
+ "Zdá se vám tento doplněk užitečný? Prosím podpořte naši práce malým darem "
29
+ "nebo napište o našem pluginu na vašem blogu či odkažte z vašeho webu na náš."
30
+
31
+ # @ cpt
32
+ #: include/functions.php:66
33
+ msgid "Did you know there is available an Advanced version of this plug-in?"
34
+ msgstr "Věděli jste, že je k dispozci pokročilejší verze tohoto pluginu?"
35
+
36
+ # @ cpt
37
+ #: include/functions.php:66
38
+ msgid "Read more"
39
+ msgstr "Více informací"
40
+
41
+ # @ cpt
42
+ #: include/functions.php:67
43
+ msgid "Check our"
44
+ msgstr "Podívejte se,"
45
+
46
+ # @ cpt
47
+ #: include/functions.php:67
48
+ msgid ""
49
+ "plugin which allow to custom sort categories and custom taxonomies terms"
50
+ msgstr ""
51
+ "na náš plugin, který vám umožní řasit rubriky a volitelné položky taxonomie."
52
+
53
+ # @ cpt
54
+ #: include/options.php:16
55
+ msgid "Settings Saved"
56
+ msgstr "Nastavení byla uložena"
57
+
58
+ # @ cpt
59
+ #: include/options.php:28
60
+ msgid "General Settings"
61
+ msgstr "Obecná nastavení"
62
+
63
+ # @ cpt
64
+ #: include/options.php:34
65
+ msgid "General"
66
+ msgstr "Obecná"
67
+
68
+ # @ cpt
69
+ #: include/options.php:39
70
+ msgid "Minimum Level to use this plugin"
71
+ msgstr "Minimální oprávnění pro použití pluginu"
72
+
73
+ # @ cpt
74
+ #: include/options.php:42
75
+ msgid "Subscriber"
76
+ msgstr "Návštěvník"
77
+
78
+ # @ cpt
79
+ #: include/options.php:43
80
+ msgid "Contributor"
81
+ msgstr "Spolupracovník"
82
+
83
+ # @ cpt
84
+ #: include/options.php:44
85
+ msgid "Author"
86
+ msgstr "Autor"
87
+
88
+ # @ cpt
89
+ #: include/options.php:45
90
+ msgid "Editor"
91
+ msgstr "Šéfredaktor"
92
+
93
+ # @ cpt
94
+ #: include/options.php:46
95
+ msgid "Administrator"
96
+ msgstr "Administrátor"
97
+
98
+ # @ cpt
99
+ #: include/options.php:52
100
+ msgid "Auto Sort"
101
+ msgstr "Automatické řazení"
102
+
103
+ # @ cpt
104
+ #: include/options.php:56
105
+ msgid ""
106
+ "If checked, the plug-in will automatically update the wp-queries to use the "
107
+ "new order (<b>No code update is necessarily</b>).<br /> If you need more "
108
+ "order customizations you will need to uncheck this and include 'menu_order' "
109
+ "into your theme queries"
110
+ msgstr ""
111
+ "Pokud je zaškrtnuto, plugin automaticky aktualizuje wp-queries, aby mohl "
112
+ "použít nové pořadí. (<b>Žádná aktualizace kˇodu není třeba</b>).<br /> Pokud "
113
+ "vyžadujete více možností přizpůsobení budete muset zakázat tuto volbu a "
114
+ "integrovat 'menu_order' do souborů vaší šablony."
115
+
116
+ # @ cpt
117
+ #: include/options.php:58
118
+ msgid "Show Examples"
119
+ msgstr "Zobrazit příklady"
120
+
121
+ # @ cpt
122
+ #: include/options.php:61
123
+ msgid "The following PHP code will still return the post in the set-up Order"
124
+ msgstr "Následující kód PHP umožní zobrazení příspěvků ve výchozím pořadí"
125
+
126
+ # @ cpt
127
+ #: include/options.php:74
128
+ msgid "Or"
129
+ msgstr "Nebo"
130
+
131
+ # @ cpt
132
+ #: include/options.php:83
133
+ msgid ""
134
+ "If the Auto Sort is uncheck you will need to use the \"orderby\" and \"order"
135
+ "\" parameters"
136
+ msgstr ""
137
+ "Pokud není zaškrtnuto automatické třídění budete muset použít parametry "
138
+ "\"orderby\" a \"order\""
139
+
140
+ # @ cpt
141
+ #: include/options.php:98
142
+ msgid "Admin Sort"
143
+ msgstr "Třídění v adminu"
144
+
145
+ # @ cpt
146
+ #: include/options.php:102
147
+ msgid ""
148
+ "To affect the admin interface, to see the post types per your new sort, this "
149
+ "need to be checked"
150
+ msgstr ""
151
+ "Toto musí být zaškrtnuto, aby byla povolena funkce řazení z adminu a abyste "
152
+ "mohli vidět nové řazení vašich příspěvků."
153
+
154
+ # @ cpt
155
+ #: include/options.php:111
156
+ msgid "Save Settings"
157
+ msgstr "Uložit nastavení"
158
+
159
+ # @ cpt
160
+ #: post-types-order.php:124
161
+ msgid "Post Types Order must be configured. Please go to"
162
+ msgstr "Pořadí položek musí být nakonfigurováno. Prosím přejděte na "
163
+
164
+ # @ cpt
165
+ #: post-types-order.php:124
166
+ msgid "Settings Page"
167
+ msgstr "stránku nastavení"
168
+
169
+ # @ cpt
170
+ #: post-types-order.php:124
171
+ msgid "make the configuration and save"
172
+ msgstr "nastavte plugin a uložte nastavení."
173
+
174
+ # @ cpt
175
+ #: post-types-order.php:468 post-types-order.php:472 post-types-order.php:483
176
+ msgid "Re-Order"
177
+ msgstr "Seřadit"
178
+
179
+ # @ cpt
180
+ #: post-types-order.php:491
181
+ msgid ""
182
+ "This plugin can't work without javascript, because it's use drag and drop "
183
+ "and AJAX."
184
+ msgstr ""
185
+ "Tento plugin se bez Javasriptu neobejde, jelikož používá funkce uchop a pusť "
186
+ "a AJAX."
187
+
188
+ # @ cpt
189
+ #: post-types-order.php:504
190
+ msgid "Update"
191
+ msgstr "Aktualizovat"
192
+
193
+ # @ cpt
194
+ #: post-types-order.php:520
195
+ msgid "Items Order Updated"
196
+ msgstr "Pořádí položek bylo aktualizováno"
197
+
198
+ # @ default
199
+ #: post-types-order.php:537
200
+ msgid "Pages"
201
+ msgstr "Stránky"
post-types-order.php CHANGED
@@ -5,591 +5,332 @@ Plugin URI: http://www.nsp-code.com
5
  Description: Posts Order and Post Types Objects Order using a Drag and Drop Sortable javascript capability
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
- Version: 1.7.4
9
  */
10
 
11
- define('CPTPATH', plugin_dir_path(__FILE__));
12
- define('CPTURL', plugins_url('', __FILE__));
13
 
14
 
15
- register_deactivation_hook(__FILE__, 'CPTO_deactivated');
16
- register_activation_hook(__FILE__, 'CPTO_activated');
17
 
18
- function CPTO_activated()
19
- {
20
- //make sure the vars are set as default
21
- $options = get_option('cpto_options');
22
- if (!isset($options['autosort']))
23
- $options['autosort'] = '1';
24
 
25
- if (!isset($options['adminsort']))
26
- $options['adminsort'] = '1';
27
-
28
- if (!isset($options['capability']))
29
- $options['capability'] = 'install_plugins';
30
-
31
- update_option('cpto_options', $options);
32
- }
33
-
34
- function CPTO_deactivated()
35
- {
36
-
37
- }
38
-
39
- include_once(CPTPATH . '/include/functions.php');
40
-
41
- add_filter('pre_get_posts', 'CPTO_pre_get_posts');
42
- function CPTO_pre_get_posts($query)
43
- {
44
- //-- lee@cloudswipe.com requirement
45
- global $post;
46
- if(is_object($post) && isset($post->ID) && $post->ID < 1)
47
- { return $query; } // Stop running the function if this is a virtual page
48
- //--
49
-
50
- $options = get_option('cpto_options');
51
- if (is_admin())
52
- {
53
- //no need if it's admin interface
54
- return false;
55
- }
56
- //if auto sort
57
- if ($options['autosort'] == "1")
58
- {
59
- //remove the supresed filters;
60
- if (isset($query->query['suppress_filters']))
61
- $query->query['suppress_filters'] = FALSE;
62
 
63
-
64
- if (isset($query->query_vars['suppress_filters']))
65
- $query->query_vars['suppress_filters'] = FALSE;
66
-
67
- }
68
-
69
- return $query;
70
- }
71
 
72
- add_filter('posts_orderby', 'CPTOrderPosts', 99, 2);
73
- function CPTOrderPosts($orderBy, $query)
74
- {
75
- global $wpdb;
76
-
77
- $options = get_option('cpto_options');
78
-
79
- //ignore the bbpress
80
- if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("reply", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "reply")))
81
- return $orderBy;
82
- if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("topic", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "topic")))
83
- return $orderBy;
84
 
85
- if (is_admin())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
  {
87
-
88
- if ($options['adminsort'] == "1" &&
89
- //ignore when ajax Gallery Edit default functionality
90
- !($options['adminsort'] == "1" && defined('DOING_AJAX') && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments')
91
- )
92
- {
93
- $orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
94
- }
95
  }
96
- else
 
97
  {
98
- //ignore search
99
- if($query->is_search())
100
- return($orderBy);
101
 
102
- if ($options['autosort'] == "1")
103
- {
104
- if(trim($orderBy) == '')
105
- $orderBy = "{$wpdb->posts}.menu_order ";
106
- else
107
- $orderBy = "{$wpdb->posts}.menu_order, " . $orderBy;
108
- }
109
  }
 
 
 
110
 
111
- return($orderBy);
112
- }
113
-
114
- $is_configured = get_option('CPT_configured');
115
- if ($is_configured == '')
116
- add_action( 'admin_notices', 'CPTO_admin_notices');
117
-
118
- function CPTO_admin_notices()
119
- {
120
- if (isset($_POST['form_submit']))
121
- return;
122
- ?>
123
- <div class="error fade">
124
- <p><strong><?php _e('Post Types Order must be configured. Please go to', 'cpt') ?> <a href="<?php echo get_admin_url() ?>options-general.php?page=cpto-options"><?php _e('Settings Page', 'cpt') ?></a> <?php _e('make the configuration and save', 'cpt') ?></strong></p>
125
- </div>
126
- <?php
127
- }
128
-
129
-
130
- add_action( 'plugins_loaded', 'cpto_load_textdomain');
131
- function cpto_load_textdomain()
132
- {
133
- load_plugin_textdomain('cpt', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang');
134
- }
135
-
136
- add_action('admin_menu', 'cpto_plugin_menu');
137
- function cpto_plugin_menu()
138
- {
139
- include (CPTPATH . '/include/options.php');
140
- add_options_page('Post Types Order', '<img class="menu_pto" src="'. CPTURL .'/images/menu-icon.png" alt="" />Post Types Order', 'manage_options', 'cpto-options', 'cpt_plugin_options');
141
- }
142
-
143
-
144
- add_action('wp_loaded', 'initCPTO' );
145
- function initCPTO()
146
- {
147
- global $custom_post_type_order, $userdata;
148
-
149
- $options = get_option('cpto_options');
150
-
151
- if (is_admin())
152
- {
153
- if(isset($options['capability']) && !empty($options['capability']))
154
  {
155
- if(current_user_can($options['capability']))
156
- $custom_post_type_order = new CPTO();
 
 
 
 
 
 
157
  }
158
- else if (is_numeric($options['level']))
159
  {
160
- if (userdata_get_user_level(true) >= $options['level'])
161
- $custom_post_type_order = new CPTO();
 
 
 
 
 
 
 
 
 
162
  }
163
- else
164
- {
165
- $custom_post_type_order = new CPTO();
166
- }
167
- }
168
- }
169
-
170
- add_filter('get_previous_post_where', 'cpto_get_previous_post_where');
171
- add_filter('get_previous_post_sort', 'cpto_get_previous_post_sort');
172
- add_filter('get_next_post_where', 'cpto_get_next_post_where');
173
- add_filter('get_next_post_sort', 'cpto_get_next_post_sort');
174
- function cpto_get_previous_post_where($where)
175
- {
176
- global $post, $wpdb;
177
-
178
- if ( empty( $post ) )
179
- return $where;
180
 
181
- $current_post_date = $post->post_date;
 
182
 
183
- $join = '';
184
- $posts_in_ex_cats_sql = '';
185
- if (isset($in_same_cat))
186
- if ( $in_same_cat || !empty($excluded_categories) )
187
- {
188
- $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
 
 
 
 
 
 
 
 
189
 
190
- if ( $in_same_cat ) {
191
- $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
192
- $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
193
- }
194
 
195
- $posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'";
196
- if ( !empty($excluded_categories) ) {
197
- $excluded_categories = array_map('intval', explode(' and ', $excluded_categories));
198
- if ( !empty($cat_array) ) {
199
- $excluded_categories = array_diff($excluded_categories, $cat_array);
200
- $posts_in_ex_cats_sql = '';
201
- }
 
 
 
 
 
202
 
203
- if ( !empty($excluded_categories) ) {
204
- $posts_in_ex_cats_sql = " AND tt.taxonomy = 'category' AND tt.term_id NOT IN (" . implode($excluded_categories, ',') . ')';
205
- }
206
- }
207
- }
208
- $current_menu_order = $post->menu_order;
209
 
210
- //check if there are more posts with lower menu_order
211
- $query = "SELECT p.* FROM $wpdb->posts AS p
212
- WHERE p.menu_order < '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql";
213
- $results = $wpdb->get_results($query);
214
-
215
- if (count($results) > 0)
216
- {
217
- $where = "WHERE p.menu_order < '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql";
218
- }
219
- else
220
  {
221
- $where = "WHERE p.post_date < '".$current_post_date."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' AND p.ID != '". $post->ID ."' $posts_in_ex_cats_sql";
222
- }
223
-
224
- return $where;
225
- }
226
-
227
- function cpto_get_previous_post_sort($sort)
228
- {
229
- global $post, $wpdb;
230
- $posts_in_ex_cats_sql = '';
 
 
 
 
 
 
231
 
232
- $current_menu_order = $post->menu_order;
233
 
234
- $query = "SELECT p.* FROM $wpdb->posts AS p
235
- WHERE p.menu_order < '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql";
236
- $results = $wpdb->get_results($query);
237
 
238
- if (count($results) > 0)
239
- {
240
- $sort = 'ORDER BY p.menu_order DESC, p.post_date ASC LIMIT 1';
241
- }
242
- else
243
- {
244
- $sort = 'ORDER BY p.post_date DESC LIMIT 1';
245
- }
246
 
247
- return $sort;
248
- }
 
 
 
249
 
250
- function cpto_get_next_post_where($where)
251
- {
252
- global $post, $wpdb;
 
 
 
 
253
 
254
- if ( empty( $post ) )
255
- return null;
 
 
 
 
 
 
 
 
 
 
 
 
 
256
 
257
- $current_post_date = $post->post_date;
 
 
258
 
259
- $join = '';
260
- $posts_in_ex_cats_sql = '';
261
- if (isset($in_same_cat))
262
- if ( $in_same_cat || !empty($excluded_categories) )
263
- {
264
- $join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
265
 
266
- if ( $in_same_cat ) {
267
- $cat_array = wp_get_object_terms($post->ID, 'category', array('fields' => 'ids'));
268
- $join .= " AND tt.taxonomy = 'category' AND tt.term_id IN (" . implode(',', $cat_array) . ")";
269
  }
270
-
271
- $posts_in_ex_cats_sql = "AND tt.taxonomy = 'category'";
272
- if ( !empty($excluded_categories) ) {
273
- $excluded_categories = array_map('intval', explode(' and ', $excluded_categories));
274
- if ( !empty($cat_array) ) {
275
- $excluded_categories = array_diff($excluded_categories, $cat_array);
276
- $posts_in_ex_cats_sql = '';
 
 
 
 
277
  }
278
-
279
- if ( !empty($excluded_categories) ) {
280
- $posts_in_ex_cats_sql = " AND tt.taxonomy = 'category' AND tt.term_id NOT IN (" . implode($excluded_categories, ',') . ')';
281
  }
282
- }
283
- }
284
-
285
- $current_menu_order = $post->menu_order;
286
-
287
- //check if there are more posts with lower menu_order
288
- $query = "SELECT p.* FROM $wpdb->posts AS p
289
- WHERE p.menu_order > '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql";
290
- $results = $wpdb->get_results($query);
291
-
292
- if (count($results) > 0)
293
- {
294
- $where = "WHERE p.menu_order > '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql";
295
- }
296
- else
297
- {
298
- $where = "WHERE p.post_date > '".$current_post_date."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' AND p.ID != '". $post->ID ."' $posts_in_ex_cats_sql";
299
- }
300
-
301
- return $where;
302
- }
303
-
304
- function cpto_get_next_post_sort($sort)
305
- {
306
- global $post, $wpdb;
307
- $posts_in_ex_cats_sql = '';
308
-
309
- $current_menu_order = $post->menu_order;
310
-
311
- $query = "SELECT p.* FROM $wpdb->posts AS p
312
- WHERE p.menu_order > '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $posts_in_ex_cats_sql";
313
- $results = $wpdb->get_results($query);
314
- if (count($results) > 0)
315
- {
316
- $sort = 'ORDER BY p.menu_order ASC, p.post_date DESC LIMIT 1';
317
- }
318
- else
319
- {
320
- $sort = 'ORDER BY p.post_date ASC LIMIT 1';
321
- }
322
-
323
- return $sort;
324
- }
325
-
326
-
327
- class Post_Types_Order_Walker extends Walker
328
- {
329
-
330
- var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
331
-
332
-
333
- function start_lvl(&$output, $depth = 0, $args = array()) {
334
- $indent = str_repeat("\t", $depth);
335
- $output .= "\n$indent<ul class='children'>\n";
336
  }
 
 
 
 
 
 
337
 
338
-
339
- function end_lvl(&$output, $depth = 0, $args = array()) {
340
- $indent = str_repeat("\t", $depth);
341
- $output .= "$indent</ul>\n";
342
  }
343
 
 
 
 
344
 
345
- function start_el(&$output, $page, $depth = 0, $args = array(), $id = 0) {
346
- if ( $depth )
347
- $indent = str_repeat("\t", $depth);
348
- else
349
- $indent = '';
350
-
351
- extract($args, EXTR_SKIP);
352
-
353
- $output .= $indent . '<li id="item_'.$page->ID.'"><span>'.apply_filters( 'the_title', $page->post_title, $page->ID ).'</span>';
354
- }
355
 
 
 
 
 
 
 
 
356
 
357
- function end_el(&$output, $page, $depth = 0, $args = array()) {
358
- $output .= "</li>\n";
359
- }
 
 
 
 
 
 
 
 
 
 
 
 
360
 
361
- }
 
 
362
 
 
 
 
 
 
 
363
 
364
- class CPTO
365
- {
366
- var $current_post_type = null;
367
-
368
- function CPTO()
369
- {
370
- add_action( 'admin_init', array(&$this, 'registerFiles'), 11 );
371
- add_action( 'admin_init', array(&$this, 'checkPost'), 10 );
372
- add_action( 'admin_menu', array(&$this, 'addMenu') );
373
-
374
 
375
-
376
- add_action( 'wp_ajax_update-custom-type-order', array(&$this, 'saveAjaxOrder') );
377
- }
378
-
379
- function registerFiles()
380
- {
381
- if ( $this->current_post_type != null )
382
- {
383
- wp_enqueue_script('jQuery');
384
- wp_enqueue_script('jquery-ui-sortable');
385
- }
386
 
387
- wp_register_style('CPTStyleSheets', CPTURL . '/css/cpt.css');
388
- wp_enqueue_style( 'CPTStyleSheets');
389
- }
390
-
391
- function checkPost()
392
- {
393
- if ( isset($_GET['page']) && substr($_GET['page'], 0, 17) == 'order-post-types-' )
394
  {
395
- $this->current_post_type = get_post_type_object(str_replace( 'order-post-types-', '', $_GET['page'] ));
396
- if ( $this->current_post_type == null)
397
- {
398
- wp_die('Invalid post type');
399
- }
400
- }
401
- }
402
-
403
- function saveAjaxOrder()
404
- {
405
- global $wpdb;
406
-
407
- parse_str($_POST['order'], $data);
408
-
409
- if (is_array($data))
410
- foreach($data as $key => $values )
411
- {
412
- if ( $key == 'item' )
413
- {
414
- foreach( $values as $position => $id )
415
- {
416
- $data = array('menu_order' => $position, 'post_parent' => 0);
417
- $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
418
-
419
- $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
420
- }
421
- }
422
- else
423
- {
424
- foreach( $values as $position => $id )
425
- {
426
- $data = array('menu_order' => $position, 'post_parent' => str_replace('item_', '', $key));
427
- $data = apply_filters('post-types-order_save-ajax-order', $data, $key, $id);
428
-
429
- $wpdb->update( $wpdb->posts, $data, array('ID' => $id) );
430
- }
431
- }
432
- }
433
- }
434
-
435
-
436
- function addMenu()
437
- {
438
- global $userdata;
439
- //put a menu for all custom_type
440
- $post_types = get_post_types();
441
-
442
- $options = get_option('cpto_options');
443
- //get the required user capability
444
- $capability = '';
445
- if(isset($options['capability']) && !empty($options['capability']))
446
- {
447
- $capability = $options['capability'];
448
  }
449
- else if (is_numeric($options['level']))
450
  {
451
- $capability = userdata_get_user_level();
452
  }
453
- else
454
- {
455
- $capability = 'install_plugins';
456
- }
457
-
458
- foreach( $post_types as $post_type_name )
459
- {
460
- if ($post_type_name == 'page')
461
- continue;
462
-
463
- //ignore bbpress
464
- if ($post_type_name == 'reply' || $post_type_name == 'topic')
465
- continue;
466
-
467
- if ($post_type_name == 'post')
468
- add_submenu_page('edit.php', __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
469
- else
470
- {
471
- if (!is_post_type_hierarchical($post_type_name))
472
- add_submenu_page('edit.php?post_type='.$post_type_name, __('Re-Order', 'cpt'), __('Re-Order', 'cpt'), $capability, 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
473
- }
474
- }
475
- }
476
-
477
-
478
- function SortPage()
479
- {
480
- ?>
481
- <div class="wrap">
482
- <div class="icon32" id="icon-edit"><br></div>
483
- <h2><?php echo $this->current_post_type->labels->singular_name . ' - '. __('Re-Order', 'cpt') ?></h2>
484
-
485
- <?php cpt_info_box(); ?>
486
-
487
- <div id="ajax-response"></div>
488
-
489
- <noscript>
490
- <div class="error message">
491
- <p><?php _e('This plugin can\'t work without javascript, because it\'s use drag and drop and AJAX.', 'cpt') ?></p>
492
- </div>
493
- </noscript>
494
-
495
- <div id="order-post-type">
496
- <ul id="sortable">
497
- <?php $this->listPages('hide_empty=0&title_li=&post_type='.$this->current_post_type->name); ?>
498
- </ul>
499
-
500
- <div class="clear"></div>
501
- </div>
502
-
503
- <p class="submit">
504
- <a href="#" id="save-order" class="button-primary"><?php _e('Update', 'cpt' ) ?></a>
505
- </p>
506
-
507
- <script type="text/javascript">
508
- jQuery(document).ready(function() {
509
- jQuery("#sortable").sortable({
510
- 'tolerance':'intersect',
511
- 'cursor':'pointer',
512
- 'items':'li',
513
- 'placeholder':'placeholder',
514
- 'nested': 'ul'
515
- });
516
-
517
- jQuery("#sortable").disableSelection();
518
- jQuery("#save-order").bind( "click", function() {
519
- jQuery.post( ajaxurl, { action:'update-custom-type-order', order:jQuery("#sortable").sortable("serialize") }, function() {
520
- jQuery("#ajax-response").html('<div class="message updated fade"><p><?php _e('Items Order Updated', 'cpt') ?></p></div>');
521
- jQuery("#ajax-response div").delay(3000).hide("slow");
522
- });
523
- });
524
- });
525
- </script>
526
-
527
- </div>
528
- <?php
529
- }
530
-
531
- function listPages($args = '')
532
- {
533
- $defaults = array(
534
- 'depth' => 0, 'show_date' => '',
535
- 'date_format' => get_option('date_format'),
536
- 'child_of' => 0, 'exclude' => '',
537
- 'title_li' => __('Pages'), 'echo' => 1,
538
- 'authors' => '', 'sort_column' => 'menu_order',
539
- 'link_before' => '', 'link_after' => '', 'walker' => ''
540
- );
541
-
542
- $r = wp_parse_args( $args, $defaults );
543
- extract( $r, EXTR_SKIP );
544
-
545
- $output = '';
546
-
547
- $r['exclude'] = preg_replace('/[^0-9,]/', '', $r['exclude']);
548
- $exclude_array = ( $r['exclude'] ) ? explode(',', $r['exclude']) : array();
549
- $r['exclude'] = implode( ',', apply_filters('wp_list_pages_excludes', $exclude_array) );
550
-
551
- // Query pages.
552
- $r['hierarchical'] = 0;
553
- $args = array(
554
- 'sort_column' => 'menu_order',
555
- 'post_type' => $post_type,
556
- 'posts_per_page' => -1,
557
- 'orderby' => 'menu_order',
558
- 'order' => 'ASC'
559
- );
560
-
561
- $the_query = new WP_Query($args);
562
- $pages = $the_query->posts;
563
-
564
- if ( !empty($pages) ) {
565
- if ( $r['title_li'] )
566
- $output .= '<li class="pagenav intersect">' . $r['title_li'] . '<ul>';
567
-
568
- $output .= $this->walkTree($pages, $r['depth'], $r);
569
-
570
- if ( $r['title_li'] )
571
- $output .= '</ul></li>';
572
- }
573
-
574
- $output = apply_filters('wp_list_pages', $output, $r);
575
-
576
- if ( $r['echo'] )
577
- echo $output;
578
- else
579
- return $output;
580
- }
581
-
582
- function walkTree($pages, $depth, $r)
583
- {
584
- if ( empty($r['walker']) )
585
- $walker = new Post_Types_Order_Walker;
586
- else
587
- $walker = $r['walker'];
588
-
589
- $args = array($pages, $depth, $r);
590
- return call_user_func_array(array(&$walker, 'walk'), $args);
591
- }
592
- }
593
-
594
 
595
  ?>
5
  Description: Posts Order and Post Types Objects Order using a Drag and Drop Sortable javascript capability
6
  Author: Nsp Code
7
  Author URI: http://www.nsp-code.com
8
+ Version: 1.7.7
9
  */
10
 
11
+ define('CPTPATH', plugin_dir_path(__FILE__));
12
+ define('CPTURL', plugins_url('', __FILE__));
13
 
14
 
15
+ register_deactivation_hook(__FILE__, 'CPTO_deactivated');
16
+ register_activation_hook(__FILE__, 'CPTO_activated');
17
 
18
+ function CPTO_activated()
19
+ {
20
+ //make sure the vars are set as default
21
+ $options = get_option('cpto_options');
 
 
22
 
23
+ $defaults = array (
24
+ 'autosort' => 1,
25
+ 'adminsort' => 1,
26
+ 'capability' => 'install_plugins'
27
+ );
28
+ $options = wp_parse_args( $options, $defaults );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
 
30
+ update_option('cpto_options', $options);
31
+ }
 
 
 
 
 
 
32
 
33
+ function CPTO_deactivated()
34
+ {
35
+
36
+ }
 
 
 
 
 
 
 
 
37
 
38
+ include_once(CPTPATH . '/include/functions.php');
39
+ include_once(CPTPATH . '/include/walkers.php');
40
+ include_once(CPTPATH . '/include/cpto-class.php');
41
+
42
+ add_filter('pre_get_posts', 'CPTO_pre_get_posts');
43
+ function CPTO_pre_get_posts($query)
44
+ {
45
+ //-- lee@cloudswipe.com requirement
46
+ global $post;
47
+ if(is_object($post) && isset($post->ID) && $post->ID < 1)
48
+ { return $query; } // Stop running the function if this is a virtual page
49
+ //--
50
+
51
+ $options = get_option('cpto_options');
52
+ if (is_admin())
53
  {
54
+ //no need if it's admin interface
55
+ return false;
 
 
 
 
 
 
56
  }
57
+ //if auto sort
58
+ if ($options['autosort'] == "1")
59
  {
60
+ //remove the supresed filters;
61
+ if (isset($query->query['suppress_filters']))
62
+ $query->query['suppress_filters'] = FALSE;
63
 
64
+
65
+ if (isset($query->query_vars['suppress_filters']))
66
+ $query->query_vars['suppress_filters'] = FALSE;
67
+
 
 
 
68
  }
69
+
70
+ return $query;
71
+ }
72
 
73
+ add_filter('posts_orderby', 'CPTOrderPosts', 99, 2);
74
+ function CPTOrderPosts($orderBy, $query)
75
+ {
76
+ global $wpdb;
77
+
78
+ $options = get_option('cpto_options');
79
+
80
+ //ignore the bbpress
81
+ if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("reply", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "reply")))
82
+ return $orderBy;
83
+ if (isset($query->query_vars['post_type']) && ((is_array($query->query_vars['post_type']) && in_array("topic", $query->query_vars['post_type'])) || ($query->query_vars['post_type'] == "topic")))
84
+ return $orderBy;
85
+
86
+ if (is_admin())
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
  {
88
+
89
+ if ($options['adminsort'] == "1" &&
90
+ //ignore when ajax Gallery Edit default functionality
91
+ !($options['adminsort'] == "1" && defined('DOING_AJAX') && isset($_REQUEST['action']) && $_REQUEST['action'] == 'query-attachments')
92
+ )
93
+ {
94
+ $orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
95
+ }
96
  }
97
+ else
98
  {
99
+ //ignore search
100
+ if($query->is_search())
101
+ return($orderBy);
102
+
103
+ if ($options['autosort'] == "1")
104
+ {
105
+ if(trim($orderBy) == '')
106
+ $orderBy = "{$wpdb->posts}.menu_order ";
107
+ else
108
+ $orderBy = "{$wpdb->posts}.menu_order, " . $orderBy;
109
+ }
110
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
+ return($orderBy);
113
+ }
114
 
115
+ $is_configured = get_option('CPT_configured');
116
+ if ($is_configured == '')
117
+ add_action( 'admin_notices', 'CPTO_admin_notices');
118
+
119
+ function CPTO_admin_notices()
120
+ {
121
+ if (isset($_POST['form_submit']))
122
+ return;
123
+ ?>
124
+ <div class="error fade">
125
+ <p><strong><?php _e('Post Types Order must be configured. Please go to', 'cpt') ?> <a href="<?php echo get_admin_url() ?>options-general.php?page=cpto-options"><?php _e('Settings Page', 'cpt') ?></a> <?php _e('make the configuration and save', 'cpt') ?></strong></p>
126
+ </div>
127
+ <?php
128
+ }
129
 
 
 
 
 
130
 
131
+ add_action( 'plugins_loaded', 'cpto_load_textdomain');
132
+ function cpto_load_textdomain()
133
+ {
134
+ load_plugin_textdomain('cpt', FALSE, dirname( plugin_basename( __FILE__ ) ) . '/lang');
135
+ }
136
+
137
+ add_action('admin_menu', 'cpto_plugin_menu');
138
+ function cpto_plugin_menu()
139
+ {
140
+ include (CPTPATH . '/include/options.php');
141
+ add_options_page('Post Types Order', '<img class="menu_pto" src="'. CPTURL .'/images/menu-icon.png" alt="" />Post Types Order', 'manage_options', 'cpto-options', 'cpt_plugin_options');
142
+ }
143
 
 
 
 
 
 
 
144
 
145
+ add_action('wp_loaded', 'initCPTO' );
146
+ function initCPTO()
147
+ {
148
+ global $custom_post_type_order, $userdata;
149
+
150
+ $options = get_option('cpto_options');
151
+
152
+ if (is_admin())
 
 
153
  {
154
+ if(isset($options['capability']) && !empty($options['capability']))
155
+ {
156
+ if(current_user_can($options['capability']))
157
+ $custom_post_type_order = new CPTO();
158
+ }
159
+ else if (is_numeric($options['level']))
160
+ {
161
+ if (userdata_get_user_level(true) >= $options['level'])
162
+ $custom_post_type_order = new CPTO();
163
+ }
164
+ else
165
+ {
166
+ $custom_post_type_order = new CPTO();
167
+ }
168
+ }
169
+ }
170
 
 
171
 
 
 
 
172
 
173
+ add_filter('get_previous_post_where', 'cpto_get_previous_post_where', 99, 3);
174
+ add_filter('get_previous_post_sort', 'cpto_get_previous_post_sort');
175
+ add_filter('get_next_post_where', 'cpto_get_next_post_where', 99, 3);
176
+ add_filter('get_next_post_sort', 'cpto_get_next_post_sort');
177
+
178
+ function cpto_get_previous_post_where($where, $in_same_term, $excluded_terms)
179
+ {
180
+ global $post, $wpdb;
181
 
182
+ if ( empty( $post ) )
183
+ return $where;
184
+
185
+ $_join = '';
186
+ $_where = '';
187
 
188
+ //?? WordPress does not pass through this varialbe, so we presume it's category..
189
+ $taxonomy = 'category';
190
+
191
+ if ( $in_same_term || ! empty( $excluded_terms ) )
192
+ {
193
+ $_join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
194
+ $_where = $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
195
 
196
+ if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) )
197
+ {
198
+ // back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
199
+ if ( false !== strpos( $excluded_terms, ' and ' ) )
200
+ {
201
+ _deprecated_argument( __FUNCTION__, '3.3', sprintf( __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
202
+ $excluded_terms = explode( ' and ', $excluded_terms );
203
+ }
204
+ else
205
+ {
206
+ $excluded_terms = explode( ',', $excluded_terms );
207
+ }
208
+
209
+ $excluded_terms = array_map( 'intval', $excluded_terms );
210
+ }
211
 
212
+ if ( $in_same_term )
213
+ {
214
+ $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
215
 
216
+ // Remove any exclusions from the term array to include.
217
+ $term_array = array_diff( $term_array, (array) $excluded_terms );
218
+ $term_array = array_map( 'intval', $term_array );
219
+
220
+ $_where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
221
+ }
222
 
223
+ if ( ! empty( $excluded_terms ) ) {
224
+ $_where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( $excluded_terms, ',' ) . ') )';
225
+ }
226
  }
227
+
228
+ $current_menu_order = $post->menu_order;
229
+
230
+ $query = "SELECT p.* FROM $wpdb->posts AS p
231
+ $_join
232
+ WHERE p.post_date < '". $post->post_date ."' AND p.menu_order = '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $_where";
233
+ $results = $wpdb->get_results($query);
234
+
235
+ if (count($results) > 0)
236
+ {
237
+ $where .= " AND p.menu_order = '".$current_menu_order."'";
238
  }
239
+ else
240
+ {
241
+ $where = str_replace("p.post_date < '". $post->post_date ."'", "p.menu_order > '$current_menu_order'", $where);
242
  }
243
+
244
+ return $where;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  }
246
+
247
+ function cpto_get_previous_post_sort($sort)
248
+ {
249
+ global $post, $wpdb;
250
+
251
+ $sort = 'ORDER BY p.menu_order ASC, p.post_date DESC LIMIT 1';
252
 
253
+ return $sort;
 
 
 
254
  }
255
 
256
+ function cpto_get_next_post_where($where, $in_same_term, $excluded_terms)
257
+ {
258
+ global $post, $wpdb;
259
 
260
+ if ( empty( $post ) )
261
+ return $where;
262
+
263
+ $_join = '';
264
+ $_where = '';
 
 
 
 
 
265
 
266
+ //?? WordPress does not pass through this varialbe, so we presume it's category..
267
+ $taxonomy = 'category';
268
+
269
+ if ( $in_same_term || ! empty( $excluded_terms ) )
270
+ {
271
+ $_join = " INNER JOIN $wpdb->term_relationships AS tr ON p.ID = tr.object_id INNER JOIN $wpdb->term_taxonomy tt ON tr.term_taxonomy_id = tt.term_taxonomy_id";
272
+ $_where = $wpdb->prepare( "AND tt.taxonomy = %s", $taxonomy );
273
 
274
+ if ( ! empty( $excluded_terms ) && ! is_array( $excluded_terms ) )
275
+ {
276
+ // back-compat, $excluded_terms used to be $excluded_terms with IDs separated by " and "
277
+ if ( false !== strpos( $excluded_terms, ' and ' ) )
278
+ {
279
+ _deprecated_argument( __FUNCTION__, '3.3', sprintf( __( 'Use commas instead of %s to separate excluded terms.' ), "'and'" ) );
280
+ $excluded_terms = explode( ' and ', $excluded_terms );
281
+ }
282
+ else
283
+ {
284
+ $excluded_terms = explode( ',', $excluded_terms );
285
+ }
286
+
287
+ $excluded_terms = array_map( 'intval', $excluded_terms );
288
+ }
289
 
290
+ if ( $in_same_term )
291
+ {
292
+ $term_array = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'ids' ) );
293
 
294
+ // Remove any exclusions from the term array to include.
295
+ $term_array = array_diff( $term_array, (array) $excluded_terms );
296
+ $term_array = array_map( 'intval', $term_array );
297
+
298
+ $_where .= " AND tt.term_id IN (" . implode( ',', $term_array ) . ")";
299
+ }
300
 
301
+ if ( ! empty( $excluded_terms ) ) {
302
+ $_where .= " AND p.ID NOT IN ( SELECT tr.object_id FROM $wpdb->term_relationships tr LEFT JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE tt.term_id IN (" . implode( $excluded_terms, ',' ) . ') )';
303
+ }
304
+ }
 
 
 
 
 
 
305
 
306
+ $current_menu_order = $post->menu_order;
307
+
308
+ //check if there are more posts with lower menu_order
309
+ $query = "SELECT p.* FROM $wpdb->posts AS p
310
+ $_join
311
+ WHERE p.post_date > '". $post->post_date ."' AND p.menu_order = '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish' $_where";
312
+ $results = $wpdb->get_results($query);
 
 
 
 
313
 
314
+ if (count($results) > 0)
 
 
 
 
 
 
315
  {
316
+ $where .= " AND p.menu_order = '".$current_menu_order."'";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
317
  }
318
+ else
319
  {
320
+ $where = str_replace("p.post_date > '". $post->post_date ."'", "p.menu_order < '$current_menu_order'", $where);
321
  }
322
+
323
+ return $where;
324
+ }
325
+
326
+ function cpto_get_next_post_sort($sort)
327
+ {
328
+ global $post, $wpdb;
329
+
330
+ $sort = 'ORDER BY p.menu_order DESC, p.post_date ASC LIMIT 1';
331
+
332
+ return $sort;
333
+ }
334
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
 
336
  ?>
readme.txt CHANGED
@@ -1,173 +1,180 @@
1
- === Post Types Order ===
2
- Contributors: Nsp Code
3
- Donate link: http://www.nsp-code.com/donate.php
4
- Tags: post order, post type order, custom order, admin posts order
5
- Requires at least: 2.8
6
- Tested up to: 4.0
7
- Stable tag: 1.7.4
8
-
9
- Post Order and custom Post Type Objects (posts, any custom post types) using a Drag and Drop Sortable JavaScript AJAX interface.
10
-
11
- == Description ==
12
-
13
- <strong>Over 700.000 DOWNLOADS and near PERFECT ratting out of 230 REVIEWS</strong>. <br />
14
- A powerful plugin, Order Posts and Post Types Objects using a Drag and Drop Sortable JavaScript capability.
15
- It allow to reorder the posts for any custom post types you defined, including the default Posts. Also you can have the admin posts interface sorted per your new sort. <strong>Post Order</strong> has never been easier.
16
-
17
- = Usage =
18
- This was built considering for everyone to be able to use no matter the WordPress experience, so it's very easy:
19
-
20
- * Install the plugin through the Install Plugins interface or by uploading the `post-types-order` folder to your `/wp-content/plugins/` directory.
21
- * Activate the <b>Post Order</b> plugin.
22
- * A new setting page will be created within Settings > Post Types Order, you should check with that, and make a first options save.
23
- * Using the AutoSort option as ON you don't need to worry about any code changes, the plugin will do the post order update on fly.
24
- * Use the Re-Order interface which appear to every custom post type (non-hierarchical) to change the post order to a new one.
25
-
26
- = Example of Usage =
27
- [youtube http://www.youtube.com/watch?v=VEbNKFSfhCc]
28
-
29
- As you can see just a matter of drag and drop and post ordering will change on front side right away.
30
- If for some reason the post order does not update on your front side, you either do something wrong or the theme code you are using does not use a standard query per WordPress Codex rules and regulations. But we can still help, use the forum to report your issue as there are many peoples who gladly help or get in touch with us.
31
-
32
- <br />
33
- <br />This plugin is developed by <a target="_blank" href="http://www.nsp-code.com">Nsp-Code</a>
34
-
35
- == Installation ==
36
-
37
- 1. Upload `post-types-order` folder to your `/wp-content/plugins/` directory.
38
- 2. Activate the plugin from Admin > Plugins menu.
39
- 3. Once activated you should check with Settings > Post Types Order
40
- 4. Use Re-Order link which appear into each post type section to make your sort.
41
-
42
-
43
- == Screenshots ==
44
-
45
- 1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif).
46
-
47
- == Frequently Asked Questions ==
48
-
49
- Feel free to contact me at electronice_delphi@yahoo.com
50
-
51
- = I have no PHP knowledge at all, i will still be able to use this plugin? =
52
-
53
- Absolutely you can! Unlike many other plugins, you don't have to do any code changes to make your post order to change accordingly to custom defined post order. There is an option to autoupdate the WordPress queries so the posts order will be returned in the required order. Anyway this can be turned off to allow customized code usage.
54
-
55
- = What kind of posts/pages this plugin allow me to sort? =
56
-
57
- You can sort ALL post types that you have defined into your wordpress as long they are not hierarhically defined: Posts (default WordPress custom post type), Movies, Reviews, Data etc..
58
-
59
- = Ok, i understand about the template post types order, how about the admin interface? =
60
-
61
- There's a option you can trigger, to see the post types order as you defined in the sort list, right into the main admin post list interface.
62
-
63
- = There is a feature that i want it implemented, can you do something about it? =
64
-
65
- All ideas are welcome and i put them on my list to be implemented into the new versions. Anyway this may take time, but if you are in a rush, please consider a small donation and we can arrange something.
66
-
67
- == Change Log ==
68
-
69
- = 1.7.4 =
70
- - Japanese translation - Git6 Sosuke Watanabe - http://git6.com/
71
- - Portuguese translation update - Pedro Mendon�a - http://www.pedromendonca.pt
72
- - Chinese translation - Coolwp coolwp.com@gmail.com
73
-
74
- = 1.7.0 =
75
- - Swedish translation - Onlinebyr�n - http://onlinebyran.se
76
- - Portuguese translation - Pedro Mendon�a - http://www.pedromendonca.pt
77
- - AJAX save filter
78
-
79
- = 1.6.8 =
80
- - Edit Gallery - image order fix
81
- - "re-order" menu item allow translation
82
- - Hungarian translation - Adam Laki - http://codeguide.hu/
83
- - Minor admin style improvments
84
-
85
-
86
- = 1.6.5 =
87
- - Updates/Fixes
88
- - German translation
89
- - Norwegian (norsk) translation
90
-
91
- = 1.6.4 =
92
- - DISALLOW_FILE_MODS fix, change the administrator capability to switch_themes
93
-
94
- = 1.6.3 =
95
- - Updates/Fixes
96
- - Menu Walker nottices Fix
97
-
98
- = 1.6.2 =
99
- - Updates/Fixes
100
- - Turkish - T�rk�e translation
101
-
102
- = 1.6.1 =
103
- - Updates/Fixes
104
- - Menu Walker nottices Fix
105
- - Hebrew translation - Lunasite Team http://www.lunasite.co.il
106
- - Dutch translation - Denver Sessink
107
-
108
- = 1.5.8 =
109
- - Updates/Fixes
110
- - Ignore Search queries when Autosort is ON
111
- - Text Instances translatable fix
112
- - Italian translation - Black Studio http://www.blackstudio.it
113
- - Spanish translation - Marcelo Cannobbio
114
-
115
- = 1.5.7 =
116
- - Updates/Fixes
117
- - Using Capabilities instead levels
118
- - Updating certain code for WordPress 3.5 compatibility
119
- - Set default order as seccondary query order param
120
-
121
- = 1.5.4 =
122
- - Updates/Fixes
123
-
124
- = 1.5.1 =
125
- - Updates/Fixes
126
-
127
- = 1.4.6 =
128
- - Get Previous / Next Posts Update
129
-
130
- = 1.4.3 =
131
- - Small improvments
132
-
133
- = 1.4.1 =
134
- - Re-Order Menu Item Appearance fix for update versions
135
- - Improved post order code
136
-
137
- = 1.3.9 =
138
- - Re-Order Menu Item Appearance fix
139
-
140
- = 1.3.8 =
141
- - Another Plugin conflict fix (thanks Steve Reed)
142
- - Multiple Improvments (thanks for support Video Geek - bestpocketvideocams.com)
143
- - Localisation Update (thanks Gabriel Reguly - ppgr.com.br/wordpress/)
144
-
145
- = 1.1.2 =
146
- - Bug Fix
147
-
148
- = 1.0.9 =
149
- - Admin will set the roles which can use the plugins (thanks for support Nick - peerpressurecreative.com)
150
-
151
- = 1.0.2 =
152
- - Default order used if no sort occour
153
-
154
- = 1.0.1 =
155
- - Post order support implemented
156
-
157
- = 1.0 =
158
- - First stable version (thanks for support Andrew - PageLines.com)
159
-
160
- = 0.9. =
161
- - Initial Release
162
-
163
-
164
- == Upgrade Notice ==
165
-
166
- Make sure you get the latest version.
167
-
168
-
169
- == Localization ==
170
-
171
- Available in English, Brazilian Portuguese, Spanish, Romanian, Italian, Dusth, Hebrew, German, Norwegian (norsk), Turkish (t�rk�e), Swedish, Hungarian, Portuguese, Chinese
172
- Want to contribute with a translation to your language? Please contact us at electronice_delphi@yahoo.com
173
- http://www.nsp-code.com
 
 
 
 
 
 
 
1
+ === Post Types Order ===
2
+ Contributors: Nsp Code
3
+ Donate link: http://www.nsp-code.com/donate.php
4
+ Tags: post order, post type order, custom order, admin posts order
5
+ Requires at least: 2.8
6
+ Tested up to: 4.1
7
+ Stable tag: 1.7.7
8
+
9
+ Post Order and custom Post Type Objects (posts, any custom post types) using a Drag and Drop Sortable JavaScript AJAX interface.
10
+
11
+ == Description ==
12
+
13
+ <strong>Over 800.000 DOWNLOADS and near PERFECT ratting out of 250 REVIEWS</strong>. <br />
14
+ A powerful plugin, Order Posts and Post Types Objects using a Drag and Drop Sortable JavaScript capability.
15
+ It allow to reorder the posts for any custom post types you defined, including the default Posts. Also you can have the admin posts interface sorted per your new sort. Post Order has never been easier.
16
+
17
+ = Usage =
18
+ This was built considering for everyone to be able to use no matter the WordPress experience, so it's very easy:
19
+
20
+ * Install the plugin through the Install Plugins interface or by uploading the `post-types-order` folder to your `/wp-content/plugins/` directory.
21
+ * Activate the Post Order plugin.
22
+ * A new setting page will be created within Settings > Post Types Order, you should check with that, and make a first options save.
23
+ * Using the AutoSort option as ON you don't need to worry about any code changes, the plugin will do the post order update on fly.
24
+ * Use the Re-Order interface which appear to every custom post type (non-hierarchical) to change the post order to a new one.
25
+
26
+ = Example of Usage =
27
+ [youtube http://www.youtube.com/watch?v=VEbNKFSfhCc]
28
+
29
+ As you can see just a matter of drag and drop and post ordering will change on front side right away.
30
+ If for some reason the post order does not update on your front side, you either do something wrong or the theme code you are using does not use a standard query per WordPress Codex rules and regulations. But we can still help, use the forum to report your issue as there are many peoples who gladly help or get in touch with us.
31
+
32
+ <br />Check out the advanced version of this plugin at <a target="_blank" href="http://www.nsp-code.com/premium-plugins/wordpress-plugins/advanced-post-types-order/">Advanced Post Types Order</a>
33
+
34
+ <br />
35
+ <br />This plugin is developed by <a target="_blank" href="http://www.nsp-code.com">Nsp-Code</a>
36
+
37
+ == Installation ==
38
+
39
+ 1. Upload `post-types-order` folder to your `/wp-content/plugins/` directory.
40
+ 2. Activate the plugin from Admin > Plugins menu.
41
+ 3. Once activated you should check with Settings > Post Types Order
42
+ 4. Use Re-Order link which appear into each post type section to make your sort.
43
+
44
+
45
+ == Screenshots ==
46
+
47
+ 1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif).
48
+
49
+ == Frequently Asked Questions ==
50
+
51
+ Feel free to contact me at electronice_delphi@yahoo.com
52
+
53
+ = I have no PHP knowledge at all, i will still be able to use this plugin? =
54
+
55
+ Absolutely you can! Unlike many other plugins, you don't have to do any code changes to make your post order to change accordingly to custom defined post order. There is an option to autoupdate the WordPress queries so the posts order will be returned in the required order. Anyway this can be turned off to allow customized code usage.
56
+
57
+ = What kind of posts/pages this plugin allow me to sort? =
58
+
59
+ You can sort ALL post types that you have defined into your wordpress as long they are not hierarhically defined: Posts (default WordPress custom post type), Movies, Reviews, Data etc..
60
+
61
+ = Ok, i understand about the template post types order, how about the admin interface? =
62
+
63
+ There's a option you can trigger, to see the post types order as you defined in the sort list, right into the main admin post list interface.
64
+
65
+ = There is a feature that i want it implemented, can you do something about it? =
66
+
67
+ All ideas are welcome and i put them on my list to be implemented into the new versions. Anyway this may take time, but if you are in a rush, please consider a small donation and we can arrange something.
68
+
69
+ == Change Log ==
70
+
71
+ = 1.7.7 =
72
+ - Next / Previous post link functionality update
73
+ - Code improvements
74
+ - Norvegian translation update - Bjorn Johansen bjornjohansen.no
75
+ - Czech translation - dUDLAJ; Martin Kucera - http://jsemweb.cz/
76
+
77
+ = 1.7.4 =
78
+ - Japanese translation - Git6 Sosuke Watanabe - http://git6.com/
79
+ - Portuguese translation update - Pedro Mendon?a - http://www.pedromendonca.pt
80
+ - Chinese translation - Coolwp coolwp.com@gmail.com
81
+
82
+ = 1.7.0 =
83
+ - Swedish translation - Onlinebyran - http://onlinebyran.se
84
+ - Portuguese translation - Pedro Mendon?a - http://www.pedromendonca.pt
85
+ - AJAX save filter
86
+
87
+ = 1.6.8 =
88
+ - Edit Gallery - image order fix
89
+ - "re-order" menu item allow translation
90
+ - Hungarian translation - Adam Laki - http://codeguide.hu/
91
+ - Minor admin style improvments
92
+
93
+ = 1.6.5 =
94
+ - Updates/Fixes
95
+ - German translation
96
+ - Norwegian (norsk) translation
97
+
98
+ = 1.6.4 =
99
+ - DISALLOW_FILE_MODS fix, change the administrator capability to switch_themes
100
+
101
+ = 1.6.3 =
102
+ - Updates/Fixes
103
+ - Menu Walker nottices Fix
104
+
105
+ = 1.6.2 =
106
+ - Updates/Fixes
107
+ - Turkish - T?rk?e translation
108
+
109
+ = 1.6.1 =
110
+ - Updates/Fixes
111
+ - Menu Walker nottices Fix
112
+ - Hebrew translation - Lunasite Team http://www.lunasite.co.il
113
+ - Dutch translation - Denver Sessink
114
+
115
+ = 1.5.8 =
116
+ - Updates/Fixes
117
+ - Ignore Search queries when Autosort is ON
118
+ - Text Instances translatable fix
119
+ - Italian translation - Black Studio http://www.blackstudio.it
120
+ - Spanish translation - Marcelo Cannobbio
121
+
122
+ = 1.5.7 =
123
+ - Updates/Fixes
124
+ - Using Capabilities instead levels
125
+ - Updating certain code for WordPress 3.5 compatibility
126
+ - Set default order as seccondary query order param
127
+
128
+ = 1.5.4 =
129
+ - Updates/Fixes
130
+
131
+ = 1.5.1 =
132
+ - Updates/Fixes
133
+
134
+ = 1.4.6 =
135
+ - Get Previous / Next Posts Update
136
+
137
+ = 1.4.3 =
138
+ - Small improvments
139
+
140
+ = 1.4.1 =
141
+ - Re-Order Menu Item Appearance fix for update versions
142
+ - Improved post order code
143
+
144
+ = 1.3.9 =
145
+ - Re-Order Menu Item Appearance fix
146
+
147
+ = 1.3.8 =
148
+ - Another Plugin conflict fix (thanks Steve Reed)
149
+ - Multiple Improvments (thanks for support Video Geek - bestpocketvideocams.com)
150
+ - Localisation Update (thanks Gabriel Reguly - ppgr.com.br/wordpress/)
151
+
152
+ = 1.1.2 =
153
+ - Bug Fix
154
+
155
+ = 1.0.9 =
156
+ - Admin will set the roles which can use the plugins (thanks for support Nick - peerpressurecreative.com)
157
+
158
+ = 1.0.2 =
159
+ - Default order used if no sort occour
160
+
161
+ = 1.0.1 =
162
+ - Post order support implemented
163
+
164
+ = 1.0 =
165
+ - First stable version (thanks for support Andrew - PageLines.com)
166
+
167
+ = 0.9. =
168
+ - Initial Release
169
+
170
+
171
+ == Upgrade Notice ==
172
+
173
+ Make sure you get the latest version.
174
+
175
+
176
+ == Localization ==
177
+
178
+ Available in English, Brazilian Portuguese, Spanish, Romanian, Italian, Dusth, Hebrew, German, Norwegian (norsk), Turkish (t?rk?e), Swedish, Hungarian, Portuguese, Chinese, Czech
179
+ Want to contribute with a translation to your language? Please contact us at electronice_delphi@yahoo.com
180
+ http://www.nsp-code.com