Version Description
- Bug Fix
Download this release
Release Info
Developer | nsp-code |
Plugin | Post Types Order |
Version | 1.1.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.2 to 1.1.2
- css/cpt.css +8 -0
- images/admin-icon-settings.gif +0 -0
- include/options.php +62 -0
- post-types-order.php +36 -14
- readme.txt +9 -3
css/cpt.css
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
ADDED
Binary file
|
include/options.php
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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,7 +5,7 @@ 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');
|
@@ -20,13 +20,35 @@ function CPTOrderPosts($orderBy)
|
|
20 |
return($orderBy);
|
21 |
}
|
22 |
|
23 |
-
|
24 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
|
26 |
function initCPT()
|
27 |
{
|
28 |
-
global $custom_post_type_order;
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
}
|
31 |
|
32 |
|
@@ -113,7 +135,7 @@ class CPT
|
|
113 |
|
114 |
function CPT()
|
115 |
{
|
116 |
-
add_action( 'admin_init', array(&$this, '
|
117 |
add_action( 'admin_init', array(&$this, 'checkPost'), 10 );
|
118 |
add_action( 'admin_menu', array(&$this, 'addMenu') );
|
119 |
|
@@ -122,17 +144,16 @@ class CPT
|
|
122 |
add_action( 'wp_ajax_update-custom-type-order', array(&$this, 'saveAjaxOrder') );
|
123 |
}
|
124 |
|
125 |
-
function
|
126 |
{
|
127 |
if ( $this->current_post_type != null )
|
128 |
{
|
129 |
wp_enqueue_script('jQuery');
|
130 |
wp_enqueue_script('jquery-ui-sortable');
|
131 |
-
|
132 |
-
wp_register_style('CPTStyleSheets', CPTURL . '/css/cpt.css');
|
133 |
-
wp_enqueue_style( 'CPTStyleSheets');
|
134 |
-
|
135 |
}
|
|
|
|
|
|
|
136 |
}
|
137 |
|
138 |
function checkPost()
|
@@ -176,14 +197,15 @@ class CPT
|
|
176 |
|
177 |
function addMenu()
|
178 |
{
|
179 |
-
|
|
|
180 |
$post_types = get_post_types();
|
181 |
foreach( $post_types as $post_type_name )
|
182 |
{
|
183 |
if ($post_type_name == 'post')
|
184 |
-
add_submenu_page('edit.php', 'Re-Order', 'Re-Order',
|
185 |
else
|
186 |
-
add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order',
|
187 |
}
|
188 |
}
|
189 |
|
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.1.2
|
9 |
*/
|
10 |
|
11 |
define('CPTPATH', ABSPATH.'wp-content/plugins/post-types-order');
|
20 |
return($orderBy);
|
21 |
}
|
22 |
|
23 |
+
|
24 |
+
add_action('wp_loaded', 'initCPT' );
|
25 |
+
add_action('admin_menu', 'cpt_plugin_menu');
|
26 |
+
|
27 |
+
|
28 |
+
function cpt_plugin_menu()
|
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 initCPT()
|
35 |
{
|
36 |
+
global $custom_post_type_order, $userdata;
|
37 |
+
|
38 |
+
$options = get_option('cpto_options');
|
39 |
+
if (is_numeric($options['level']))
|
40 |
+
{
|
41 |
+
global $userdata;
|
42 |
+
if ($userdata->user_level >= $options['level'])
|
43 |
+
$custom_post_type_order = new CPT();
|
44 |
+
}
|
45 |
+
else
|
46 |
+
{
|
47 |
+
if (is_admin())
|
48 |
+
{
|
49 |
+
$custom_post_type_order = new CPT();
|
50 |
+
}
|
51 |
+
}
|
52 |
}
|
53 |
|
54 |
|
135 |
|
136 |
function CPT()
|
137 |
{
|
138 |
+
add_action( 'admin_init', array(&$this, 'registerFiles'), 11 );
|
139 |
add_action( 'admin_init', array(&$this, 'checkPost'), 10 );
|
140 |
add_action( 'admin_menu', array(&$this, 'addMenu') );
|
141 |
|
144 |
add_action( 'wp_ajax_update-custom-type-order', array(&$this, 'saveAjaxOrder') );
|
145 |
}
|
146 |
|
147 |
+
function registerFiles()
|
148 |
{
|
149 |
if ( $this->current_post_type != null )
|
150 |
{
|
151 |
wp_enqueue_script('jQuery');
|
152 |
wp_enqueue_script('jquery-ui-sortable');
|
|
|
|
|
|
|
|
|
153 |
}
|
154 |
+
|
155 |
+
wp_register_style('CPTStyleSheets', CPTURL . '/css/cpt.css');
|
156 |
+
wp_enqueue_style( 'CPTStyleSheets');
|
157 |
}
|
158 |
|
159 |
function checkPost()
|
197 |
|
198 |
function addMenu()
|
199 |
{
|
200 |
+
global $userdata;
|
201 |
+
//put a menu for all custom_type
|
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', $userdata->user_level, 'order-post-type-'.$post_type_name, array(&$this, 'pageManage') );
|
207 |
else
|
208 |
+
add_submenu_page('edit.php?post_type='.$post_type_name, 'Re-Order', 'Re-Order', $userdata->user_level, 'order-post-type-'.$post_type_name, array(&$this, 'pageManage') );
|
209 |
}
|
210 |
}
|
211 |
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
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, admin custom post order, custom order, ajax, re-order, drag-and-drop, admin, manage, custom, post, custom type, post type, order, ordering, sort
|
5 |
Requires at least: 3.0
|
6 |
Tested up to: 3.0.1
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
Order Post Types Objects using a Drag and Drop Sortable javascript capability
|
10 |
|
@@ -30,6 +30,12 @@ Feel free to contact me at electronice_delphi@yahoo.com
|
|
30 |
|
31 |
== Change Log ==
|
32 |
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
= 1.0.2 =
|
34 |
- Default order used if no sort occour
|
35 |
|
@@ -37,7 +43,7 @@ Feel free to contact me at electronice_delphi@yahoo.com
|
|
37 |
- Post order support implemented
|
38 |
|
39 |
= 1.0 =
|
40 |
-
- First stable version
|
41 |
|
42 |
= 0.9. =
|
43 |
- Initial Release
|
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, 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: 3.0
|
6 |
Tested up to: 3.0.1
|
7 |
+
Stable tag: 1.1.2
|
8 |
|
9 |
Order Post Types Objects using a Drag and Drop Sortable javascript capability
|
10 |
|
30 |
|
31 |
== Change Log ==
|
32 |
|
33 |
+
= 1.1.2 =
|
34 |
+
- Bug Fix
|
35 |
+
|
36 |
+
= 1.0.9 =
|
37 |
+
- Admin will set the roles which can use the plugins (thanks for support Nick - peerpressurecreative.com)
|
38 |
+
|
39 |
= 1.0.2 =
|
40 |
- Default order used if no sort occour
|
41 |
|
43 |
- Post order support implemented
|
44 |
|
45 |
= 1.0 =
|
46 |
+
- First stable version (thanks for support Andrew - PageLines.com)
|
47 |
|
48 |
= 0.9. =
|
49 |
- Initial Release
|