Version Description
- Re-Order Menu Item Appearance fix
Download this release
Release Info
Developer | nsp-code |
Plugin | Post Types Order |
Version | 1.3.9 |
Comparing to | |
See all releases |
Code changes from version 1.1.2 to 1.3.9
- css/cpt.css +0 -8
- images/admin-icon-settings.gif +0 -0
- include/options.php +0 -62
- post-types-order.php +177 -138
- readme.txt +35 -9
- screenshot-1.png +0 -0
css/cpt.css
DELETED
@@ -1,8 +0,0 @@
|
|
1 |
-
#sortable { list-style-type: none; margin: 10px 0 0; padding: 0; width: 100%; }
|
2 |
-
#sortable ul { margin-left:20px; list-style: none; }
|
3 |
-
#sortable li { margin: 4px 0; padding: 4px 0x; border: 1px solid #DDDDDD; -moz-border-radius:6px; cursor: move}
|
4 |
-
#sortable li span { display: block; background: #f7f7f7; padding: 5px; color:#808080; font-size: font-size:14px; font-weight:bold;}
|
5 |
-
#sortable li.placeholder{border: dashed 2px #ccc;background-color:#FFF;height:20px;}
|
6 |
-
|
7 |
-
#icon-settings {background-image:url("../images/admin-icon-settings.gif");background-repeat:no-repeat;}
|
8 |
-
h2.subtitle {font-size: 15px; font-style: italic; font-weight: bold}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
images/admin-icon-settings.gif
DELETED
Binary file
|
include/options.php
DELETED
@@ -1,62 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
function cpt_plugin_options()
|
5 |
-
{
|
6 |
-
$options = get_option('cpto_options');
|
7 |
-
|
8 |
-
if (isset($_POST['form_submit']))
|
9 |
-
{
|
10 |
-
|
11 |
-
$options['level'] = $_POST['level'];
|
12 |
-
|
13 |
-
echo '<div class="updated fade"><p>Settings Saved</p></div>';
|
14 |
-
|
15 |
-
update_option('cpto_options', $options);
|
16 |
-
}
|
17 |
-
|
18 |
-
$queue_data = get_option('ce_queue');
|
19 |
-
|
20 |
-
?>
|
21 |
-
<div class="wrap">
|
22 |
-
<div id="icon-settings" class="icon32"></div>
|
23 |
-
<h2>General Setings</h2>
|
24 |
-
|
25 |
-
<form id="form_data" name="form" method="post">
|
26 |
-
<br />
|
27 |
-
<h2 class="subtitle">General</h2>
|
28 |
-
<table class="form-table">
|
29 |
-
<tbody>
|
30 |
-
|
31 |
-
<tr valign="top">
|
32 |
-
<th scope="row" style="text-align: right;"><label>Minimum Level to use this plugin</label></th>
|
33 |
-
<td>
|
34 |
-
<select id="role" name="level">
|
35 |
-
<option value="0" <?php if ($options['level'] == "0") echo 'selected="selected"'?>>Subscriber</option>
|
36 |
-
<option value="1" <?php if ($options['level'] == "1") echo 'selected="selected"'?>>Contributor</option>
|
37 |
-
<option value="2" <?php if ($options['level'] == "2") echo 'selected="selected"'?>>Author</option>
|
38 |
-
<option value="5" <?php if ($options['level'] == "5") echo 'selected="selected"'?>>Editor</option>
|
39 |
-
<option value="8" <?php if ($options['level'] == "8") echo 'selected="selected"'?>>Administrator</option>
|
40 |
-
</select>
|
41 |
-
</td>
|
42 |
-
</tr>
|
43 |
-
|
44 |
-
</tbody>
|
45 |
-
</table>
|
46 |
-
|
47 |
-
|
48 |
-
<p class="submit">
|
49 |
-
<input type="submit" name="Submit" class="button-primary" value="Save Settings">
|
50 |
-
</p>
|
51 |
-
|
52 |
-
<input type="hidden" name="form_submit" value="true" />
|
53 |
-
|
54 |
-
</form>
|
55 |
-
|
56 |
-
<?php
|
57 |
-
echo '</div>';
|
58 |
-
|
59 |
-
|
60 |
-
}
|
61 |
-
|
62 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
post-types-order.php
CHANGED
@@ -5,104 +5,137 @@ Plugin URI: http://www.nsp-code.com
|
|
5 |
Description: Order Post Types Objects using a Drag and Drop Sortable javascript capability
|
6 |
Author: NSP CODE
|
7 |
Author URI: http://www.nsp-code.com
|
8 |
-
Version: 1.
|
9 |
*/
|
10 |
|
11 |
define('CPTPATH', ABSPATH.'wp-content/plugins/post-types-order');
|
12 |
define('CPTURL', get_option('siteurl').'/wp-content/plugins/post-types-order');
|
13 |
|
14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
add_filter('posts_orderby', 'CPTOrderPosts');
|
16 |
function CPTOrderPosts($orderBy)
|
17 |
{
|
18 |
global $wpdb;
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
return($orderBy);
|
21 |
}
|
22 |
|
23 |
|
24 |
-
add_action('wp_loaded', '
|
25 |
-
add_action('admin_menu', '
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
|
28 |
-
function
|
29 |
{
|
30 |
include (CPTPATH . '/include/options.php');
|
31 |
-
add_options_page('Post Types Order', 'Post Types Order', 'manage_options', 'cpto-options', 'cpt_plugin_options');
|
32 |
}
|
33 |
|
34 |
-
function
|
35 |
{
|
36 |
global $custom_post_type_order, $userdata;
|
37 |
|
38 |
$options = get_option('cpto_options');
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
{
|
49 |
-
$custom_post_type_order = new CPT();
|
50 |
-
}
|
51 |
-
}
|
52 |
}
|
53 |
|
54 |
|
55 |
-
class
|
56 |
{
|
57 |
-
|
58 |
-
* @see Walker::$tree_type
|
59 |
-
* @since 2.1.0
|
60 |
-
* @var string
|
61 |
-
*/
|
62 |
-
var $tree_type = 'page';
|
63 |
-
|
64 |
-
/**
|
65 |
-
* @see Walker::$db_fields
|
66 |
-
* @since 2.1.0
|
67 |
-
* @todo Decouple this.
|
68 |
-
* @var array
|
69 |
-
*/
|
70 |
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
|
71 |
|
72 |
-
|
73 |
-
* @see Walker::start_lvl()
|
74 |
-
* @since 2.1.0
|
75 |
-
*
|
76 |
-
* @param string $output Passed by reference. Used to append additional content.
|
77 |
-
* @param int $depth Depth of page. Used for padding.
|
78 |
-
*/
|
79 |
function start_lvl(&$output, $depth) {
|
80 |
$indent = str_repeat("\t", $depth);
|
81 |
$output .= "\n$indent<ul class='children'>\n";
|
82 |
}
|
83 |
|
84 |
-
|
85 |
-
* @see Walker::end_lvl()
|
86 |
-
* @since 2.1.0
|
87 |
-
*
|
88 |
-
* @param string $output Passed by reference. Used to append additional content.
|
89 |
-
* @param int $depth Depth of page. Used for padding.
|
90 |
-
*/
|
91 |
function end_lvl(&$output, $depth) {
|
92 |
$indent = str_repeat("\t", $depth);
|
93 |
$output .= "$indent</ul>\n";
|
94 |
}
|
95 |
|
96 |
-
|
97 |
-
* @see Walker::start_el()
|
98 |
-
* @since 2.1.0
|
99 |
-
*
|
100 |
-
* @param string $output Passed by reference. Used to append additional content.
|
101 |
-
* @param object $page Page data object.
|
102 |
-
* @param int $depth Depth of page. Used for padding.
|
103 |
-
* @param int $current_page Page ID.
|
104 |
-
* @param array $args
|
105 |
-
*/
|
106 |
function start_el(&$output, $page, $depth, $args) {
|
107 |
if ( $depth )
|
108 |
$indent = str_repeat("\t", $depth);
|
@@ -114,14 +147,7 @@ class Custom_Type_Order_Walker extends Walker
|
|
114 |
$output .= $indent . '<li id="item_'.$page->ID.'"><span>'.apply_filters( 'the_title', $page->post_title, $page->ID ).'</span>';
|
115 |
}
|
116 |
|
117 |
-
|
118 |
-
* @see Walker::end_el()
|
119 |
-
* @since 2.1.0
|
120 |
-
*
|
121 |
-
* @param string $output Passed by reference. Used to append additional content.
|
122 |
-
* @param object $page Page data object. Not used.
|
123 |
-
* @param int $depth Depth of page. Not Used.
|
124 |
-
*/
|
125 |
function end_el(&$output, $page, $depth) {
|
126 |
$output .= "</li>\n";
|
127 |
}
|
@@ -129,11 +155,11 @@ class Custom_Type_Order_Walker extends Walker
|
|
129 |
}
|
130 |
|
131 |
|
132 |
-
class
|
133 |
{
|
134 |
var $current_post_type = null;
|
135 |
|
136 |
-
function
|
137 |
{
|
138 |
add_action( 'admin_init', array(&$this, 'registerFiles'), 11 );
|
139 |
add_action( 'admin_init', array(&$this, 'checkPost'), 10 );
|
@@ -158,9 +184,9 @@ class CPT
|
|
158 |
|
159 |
function checkPost()
|
160 |
{
|
161 |
-
if ( isset($_GET['page']) && substr($_GET['page'], 0,
|
162 |
{
|
163 |
-
$this->current_post_type = get_post_type_object(str_replace( 'order-post-
|
164 |
if ( $this->current_post_type == null)
|
165 |
{
|
166 |
wp_die('Invalid post type');
|
@@ -172,10 +198,10 @@ class CPT
|
|
172 |
{
|
173 |
global $wpdb;
|
174 |
|
175 |
-
parse_str($_POST['order'], $
|
176 |
|
177 |
-
if (is_array($
|
178 |
-
foreach($
|
179 |
{
|
180 |
if ( $key == 'item' )
|
181 |
{
|
@@ -202,75 +228,68 @@ class CPT
|
|
202 |
$post_types = get_post_types();
|
203 |
foreach( $post_types as $post_type_name )
|
204 |
{
|
|
|
|
|
|
|
205 |
if ($post_type_name == 'post')
|
206 |
-
add_submenu_page('edit.php', 'Re-Order', 'Re-Order',
|
207 |
else
|
208 |
-
add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order',
|
209 |
}
|
210 |
}
|
211 |
|
212 |
|
213 |
-
function
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
<input type="hidden" name="cmd" value="_s-xclick">
|
265 |
-
<input type="hidden" name="hosted_button_id" value="CU22TFDKJMLAE">
|
266 |
-
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donateCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
|
267 |
-
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
268 |
-
</form>
|
269 |
-
</div>
|
270 |
-
<br />
|
271 |
-
</div>
|
272 |
-
<?php
|
273 |
-
}
|
274 |
|
275 |
function listPages($args = '')
|
276 |
{
|
@@ -297,7 +316,9 @@ class CPT
|
|
297 |
$args = array(
|
298 |
'sort_column' => 'menu_order',
|
299 |
'post_type' => $post_type,
|
300 |
-
'posts_per_page' => -1
|
|
|
|
|
301 |
);
|
302 |
|
303 |
$the_query = new WP_Query($args);
|
@@ -324,7 +345,7 @@ class CPT
|
|
324 |
function walkTree($pages, $depth, $r)
|
325 |
{
|
326 |
if ( empty($r['walker']) )
|
327 |
-
$walker = new
|
328 |
else
|
329 |
$walker = $r['walker'];
|
330 |
|
@@ -333,4 +354,22 @@ class CPT
|
|
333 |
}
|
334 |
}
|
335 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
336 |
?>
|
5 |
Description: Order Post Types Objects using a Drag and Drop Sortable javascript capability
|
6 |
Author: NSP CODE
|
7 |
Author URI: http://www.nsp-code.com
|
8 |
+
Version: 1.3.9
|
9 |
*/
|
10 |
|
11 |
define('CPTPATH', ABSPATH.'wp-content/plugins/post-types-order');
|
12 |
define('CPTURL', get_option('siteurl').'/wp-content/plugins/post-types-order');
|
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 |
+
update_option('cpto_options', $options);
|
29 |
+
}
|
30 |
+
|
31 |
+
function CPTO_deactivated()
|
32 |
+
{
|
33 |
+
|
34 |
+
}
|
35 |
+
|
36 |
+
add_filter('pre_get_posts', 'CPTO_pre_get_posts');
|
37 |
+
function CPTO_pre_get_posts($query)
|
38 |
+
{
|
39 |
+
|
40 |
+
$options = get_option('cpto_options');
|
41 |
+
if (is_admin())
|
42 |
+
{
|
43 |
+
//no need if it's admin interface
|
44 |
+
return false;
|
45 |
+
}
|
46 |
+
//if auto sort
|
47 |
+
if ($options['autosort'] == "1")
|
48 |
+
{
|
49 |
+
//remove the supresed filters;
|
50 |
+
if (isset($query->query['suppress_filters']))
|
51 |
+
$query->query['suppress_filters'] = FALSE;
|
52 |
+
|
53 |
+
if (isset($query->query_vars['suppress_filters']))
|
54 |
+
$query->query_vars['suppress_filters'] = FALSE;
|
55 |
+
}
|
56 |
+
|
57 |
+
return $query;
|
58 |
+
}
|
59 |
+
|
60 |
add_filter('posts_orderby', 'CPTOrderPosts');
|
61 |
function CPTOrderPosts($orderBy)
|
62 |
{
|
63 |
global $wpdb;
|
64 |
+
|
65 |
+
$options = get_option('cpto_options');
|
66 |
+
|
67 |
+
if (is_admin())
|
68 |
+
{
|
69 |
+
if ($options['adminsort'] == "1")
|
70 |
+
$orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
|
71 |
+
}
|
72 |
+
else
|
73 |
+
{
|
74 |
+
if ($options['autosort'] == "1")
|
75 |
+
$orderBy = "{$wpdb->posts}.menu_order, {$wpdb->posts}.post_date DESC";
|
76 |
+
}
|
77 |
+
|
78 |
return($orderBy);
|
79 |
}
|
80 |
|
81 |
|
82 |
+
add_action('wp_loaded', 'initCPTO' );
|
83 |
+
add_action('admin_menu', 'cpto_plugin_menu');
|
84 |
+
|
85 |
+
add_action( 'plugins_loaded', 'cpto_load_textdomain', 2 );
|
86 |
+
|
87 |
+
|
88 |
+
function cpto_load_textdomain()
|
89 |
+
{
|
90 |
+
$locale = get_locale();
|
91 |
+
$mofile = CPTPATH . '/lang/cpt-' . $locale . '.mo';
|
92 |
+
if ( file_exists( $mofile ) ) {
|
93 |
+
load_textdomain( 'cppt', $mofile );
|
94 |
+
}
|
95 |
+
}
|
96 |
|
97 |
|
98 |
+
function cpto_plugin_menu()
|
99 |
{
|
100 |
include (CPTPATH . '/include/options.php');
|
101 |
+
add_options_page('Post Types Order', '<img class="menu_pto" src="'. CPTURL .'/images/menu-icon.gif" alt="" />Post Types Order', 'manage_options', 'cpto-options', 'cpt_plugin_options');
|
102 |
}
|
103 |
|
104 |
+
function initCPTO()
|
105 |
{
|
106 |
global $custom_post_type_order, $userdata;
|
107 |
|
108 |
$options = get_option('cpto_options');
|
109 |
+
|
110 |
+
if (is_admin())
|
111 |
+
{
|
112 |
+
if (is_numeric($options['level']))
|
113 |
+
{
|
114 |
+
if (userdata_get_user_level() >= $options['level'])
|
115 |
+
$custom_post_type_order = new CPTO();
|
116 |
+
}
|
117 |
+
}
|
|
|
|
|
|
|
|
|
118 |
}
|
119 |
|
120 |
|
121 |
+
class Post_Types_Order_Walker extends Walker
|
122 |
{
|
123 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID');
|
125 |
|
126 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
function start_lvl(&$output, $depth) {
|
128 |
$indent = str_repeat("\t", $depth);
|
129 |
$output .= "\n$indent<ul class='children'>\n";
|
130 |
}
|
131 |
|
132 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
133 |
function end_lvl(&$output, $depth) {
|
134 |
$indent = str_repeat("\t", $depth);
|
135 |
$output .= "$indent</ul>\n";
|
136 |
}
|
137 |
|
138 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
function start_el(&$output, $page, $depth, $args) {
|
140 |
if ( $depth )
|
141 |
$indent = str_repeat("\t", $depth);
|
147 |
$output .= $indent . '<li id="item_'.$page->ID.'"><span>'.apply_filters( 'the_title', $page->post_title, $page->ID ).'</span>';
|
148 |
}
|
149 |
|
150 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
151 |
function end_el(&$output, $page, $depth) {
|
152 |
$output .= "</li>\n";
|
153 |
}
|
155 |
}
|
156 |
|
157 |
|
158 |
+
class CPTO
|
159 |
{
|
160 |
var $current_post_type = null;
|
161 |
|
162 |
+
function CPTO()
|
163 |
{
|
164 |
add_action( 'admin_init', array(&$this, 'registerFiles'), 11 );
|
165 |
add_action( 'admin_init', array(&$this, 'checkPost'), 10 );
|
184 |
|
185 |
function checkPost()
|
186 |
{
|
187 |
+
if ( isset($_GET['page']) && substr($_GET['page'], 0, 17) == 'order-post-types-' )
|
188 |
{
|
189 |
+
$this->current_post_type = get_post_type_object(str_replace( 'order-post-types-', '', $_GET['page'] ));
|
190 |
if ( $this->current_post_type == null)
|
191 |
{
|
192 |
wp_die('Invalid post type');
|
198 |
{
|
199 |
global $wpdb;
|
200 |
|
201 |
+
parse_str($_POST['order'], $data);
|
202 |
|
203 |
+
if (is_array($data))
|
204 |
+
foreach($data as $key => $values )
|
205 |
{
|
206 |
if ( $key == 'item' )
|
207 |
{
|
228 |
$post_types = get_post_types();
|
229 |
foreach( $post_types as $post_type_name )
|
230 |
{
|
231 |
+
if ($post_type_name == 'page')
|
232 |
+
continue;
|
233 |
+
|
234 |
if ($post_type_name == 'post')
|
235 |
+
add_submenu_page('edit.php', 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
|
236 |
else
|
237 |
+
add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order', userdata_get_user_level(), 'order-post-types-'.$post_type_name, array(&$this, 'SortPage') );
|
238 |
}
|
239 |
}
|
240 |
|
241 |
|
242 |
+
function SortPage()
|
243 |
+
{
|
244 |
+
?>
|
245 |
+
<div class="wrap">
|
246 |
+
<div class="icon32" id="icon-edit"><br></div>
|
247 |
+
<h2><?php echo $this->current_post_type->labels->singular_name . ' - Re-order '?></h2>
|
248 |
+
|
249 |
+
<div id="ajax-response"></div>
|
250 |
+
|
251 |
+
<noscript>
|
252 |
+
<div class="error message">
|
253 |
+
<p>This plugin can't work without javascript, because it's use drag and drop and AJAX.</p>
|
254 |
+
</div>
|
255 |
+
</noscript>
|
256 |
+
|
257 |
+
<div id="order-post-type">
|
258 |
+
<ul id="sortable">
|
259 |
+
<?php $this->listPages('hide_empty=0&title_li=&post_type='.$this->current_post_type->name); ?>
|
260 |
+
</ul>
|
261 |
+
|
262 |
+
<div class="clear"></div>
|
263 |
+
</div>
|
264 |
+
|
265 |
+
<p class="submit">
|
266 |
+
<a href="#" id="save-order" class="button-primary">Update</a>
|
267 |
+
</p>
|
268 |
+
|
269 |
+
<script type="text/javascript">
|
270 |
+
jQuery(document).ready(function() {
|
271 |
+
jQuery("#sortable").sortable({
|
272 |
+
'tolerance':'intersect',
|
273 |
+
'cursor':'pointer',
|
274 |
+
'grid': [50, 10],
|
275 |
+
'items':'li',
|
276 |
+
'placeholder':'placeholder',
|
277 |
+
'nested': 'ul'
|
278 |
+
});
|
279 |
+
|
280 |
+
jQuery("#sortable").disableSelection();
|
281 |
+
jQuery("#save-order").bind( "click", function() {
|
282 |
+
jQuery.post( ajaxurl, { action:'update-custom-type-order', order:jQuery("#sortable").sortable("serialize") }, function() {
|
283 |
+
jQuery("#ajax-response").html('<div class="message updated fade"><p>Items Order Updates</p></div>');
|
284 |
+
jQuery("#ajax-response div").delay(3000).hide("slow");
|
285 |
+
});
|
286 |
+
});
|
287 |
+
});
|
288 |
+
</script>
|
289 |
+
|
290 |
+
</div>
|
291 |
+
<?php
|
292 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
293 |
|
294 |
function listPages($args = '')
|
295 |
{
|
316 |
$args = array(
|
317 |
'sort_column' => 'menu_order',
|
318 |
'post_type' => $post_type,
|
319 |
+
'posts_per_page' => -1,
|
320 |
+
'orderby' => 'menu_order',
|
321 |
+
'order' => 'ASC'
|
322 |
);
|
323 |
|
324 |
$the_query = new WP_Query($args);
|
345 |
function walkTree($pages, $depth, $r)
|
346 |
{
|
347 |
if ( empty($r['walker']) )
|
348 |
+
$walker = new Post_Types_Order_Walker;
|
349 |
else
|
350 |
$walker = $r['walker'];
|
351 |
|
354 |
}
|
355 |
}
|
356 |
|
357 |
+
|
358 |
+
|
359 |
+
function userdata_get_user_level()
|
360 |
+
{
|
361 |
+
global $userdata;
|
362 |
+
|
363 |
+
$user_level = '';
|
364 |
+
for ($i=10; $i >= 0;$i--)
|
365 |
+
{
|
366 |
+
if (current_user_can('level_' . $i) === TRUE)
|
367 |
+
{
|
368 |
+
$user_level = $i;
|
369 |
+
break;
|
370 |
+
}
|
371 |
+
}
|
372 |
+
return ($user_level);
|
373 |
+
}
|
374 |
+
|
375 |
?>
|
readme.txt
CHANGED
@@ -1,23 +1,24 @@
|
|
1 |
=== Post Types Order ===
|
2 |
-
Contributors:
|
3 |
Donate link: http://www.nsp-code.com/donate.php
|
4 |
-
Tags: post type order, custom post type order, post types order, page order, post order, admin post order, admin custom post order, custom order, ajax, re-order, drag-and-drop, admin, manage, custom, post, custom type, post type, order, ordering, sort, post, page
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 3.0.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
-
Order Post Types Objects using a Drag and Drop Sortable javascript capability
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
Order Post Types Objects using a Drag and Drop Sortable javascript capability
|
14 |
-
It allow to reorder posts for any custom post types you defined
|
15 |
|
16 |
== Installation ==
|
17 |
|
18 |
1. Upload `post-types-order` folder to your `/wp-content/plugins/` directory.
|
19 |
2. Activate the plugin from Admin > Plugins menu.
|
20 |
-
3.
|
|
|
21 |
|
22 |
|
23 |
== Screenshots ==
|
@@ -28,8 +29,32 @@ It allow to reorder posts for any custom post types you defined
|
|
28 |
|
29 |
Feel free to contact me at electronice_delphi@yahoo.com
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
== Change Log ==
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
= 1.1.2 =
|
34 |
- Bug Fix
|
35 |
|
@@ -56,4 +81,5 @@ Make sure you get the latest version
|
|
56 |
|
57 |
== Localization ==
|
58 |
|
59 |
-
Currently only available in
|
|
1 |
=== Post Types Order ===
|
2 |
+
Contributors: Nsp Code
|
3 |
Donate link: http://www.nsp-code.com/donate.php
|
4 |
+
Tags: post type order, custom post type order, post types order, page order, post order, admin post order, post types sort, post type sort, admin custom post order, custom order, ajax, re-order, drag-and-drop, admin, manage, custom, post, custom type, post type, order, ordering, sort, post, page
|
5 |
+
Requires at least: 2.8
|
6 |
+
Tested up to: 3.0.4
|
7 |
+
Stable tag: 1.3.9
|
8 |
|
9 |
+
Order Post Types Objects (posts, pages, custom post types) using a Drag and Drop Sortable javascript capability
|
10 |
|
11 |
== Description ==
|
12 |
|
13 |
Order Post Types Objects using a Drag and Drop Sortable javascript capability
|
14 |
+
It allow to reorder the posts for any custom post types you defined, including the default Posts and Pages. Also you can have the admin posts interface sorted per your new sort.
|
15 |
|
16 |
== Installation ==
|
17 |
|
18 |
1. Upload `post-types-order` folder to your `/wp-content/plugins/` directory.
|
19 |
2. Activate the plugin from Admin > Plugins menu.
|
20 |
+
3. Once activated you should check with Settings > Post Types Order
|
21 |
+
4. Use Re-Order link which appear into each post type section to make your sort.
|
22 |
|
23 |
|
24 |
== Screenshots ==
|
29 |
|
30 |
Feel free to contact me at electronice_delphi@yahoo.com
|
31 |
|
32 |
+
= I have no PHP knowledge at all, i will still be able to use this plugin? =
|
33 |
+
|
34 |
+
Yes you can. There's an option to autoupdate the wordpress queries so the posts will be returned in the required order. Anyway this can be turned off to allow customized code usage.
|
35 |
+
|
36 |
+
= What kind of posts/pages this plugin allow me to sort? =
|
37 |
+
|
38 |
+
You can sort ALL post types that you have defined into your wordpress. Posts, Pages, Movies, Reviews, Data etc..
|
39 |
+
|
40 |
+
= Ok, i understand about the template post types order, how about the admin interface? =
|
41 |
+
|
42 |
+
There's a option you can trigger, to see the post types as you defined in the sort list.
|
43 |
+
|
44 |
+
= There is a feature that i want it implemented, can you do something about it? =
|
45 |
+
|
46 |
+
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.
|
47 |
+
|
48 |
== Change Log ==
|
49 |
|
50 |
+
= 1.3.9 =
|
51 |
+
- Re-Order Menu Item Appearance fix
|
52 |
+
|
53 |
+
= 1.3.8 =
|
54 |
+
- Another Plugin conflict fix (thanks Steve Reed)
|
55 |
+
- Multiple Improvments (thanks for support Video Geek - bestpocketvideocams.com)
|
56 |
+
- Localisation Update (thanks Gabriel Reguly - ppgr.com.br/wordpress/)
|
57 |
+
|
58 |
= 1.1.2 =
|
59 |
- Bug Fix
|
60 |
|
81 |
|
82 |
== Localization ==
|
83 |
|
84 |
+
Currently only available in English and Brazilian Portuguese.
|
85 |
+
Want to contribute with a translation to your language? Please contact me at electronice_delphi@yahoo.com
|
screenshot-1.png
CHANGED
Binary file
|