Version Description
Bug fixed. for WordPress 3.8
Add Swedish Translations.(by Thomas)
Download this release
Release Info
Developer | hijiri |
Plugin | Intuitive Custom Post Order |
Version | 2.0.7 |
Comparing to | |
See all releases |
Code changes from version 1.2.1 to 2.0.7
- admin/settings.php +55 -0
- intuitive-custom-post-order.php +340 -68
- lang/default.pot +30 -0
- lang/hicpo-sv_SE.mo +0 -0
- lang/hicpo-sv_SE.po +45 -0
- readme.txt +44 -7
- screenshot-1.png +0 -0
admin/settings.php
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
$hicpo_options = get_option('hicpo_options');
|
4 |
+
$objects = $hicpo_options['objects'];
|
5 |
+
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="wrap">
|
9 |
+
|
10 |
+
<?php screen_icon( 'plugins' ); ?>
|
11 |
+
|
12 |
+
<h2><?php _e('Intuitive Custom Post Order Settings', 'hicpo'); ?></h2>
|
13 |
+
|
14 |
+
<?php if ( isset($_GET['msg'] )) : ?>
|
15 |
+
<div id="message" class="updated below-h2">
|
16 |
+
<?php if ( $_GET['msg'] == 'update') : ?>
|
17 |
+
<p><?php _e('Settings saved.', 'hicpo'); ?></p>
|
18 |
+
<?php endif; ?>
|
19 |
+
</div>
|
20 |
+
<?php endif; ?>
|
21 |
+
|
22 |
+
<form method="post">
|
23 |
+
|
24 |
+
<?php if ( function_exists( 'wp_nonce_field' ) ) wp_nonce_field( 'nonce_hicpo' ); ?>
|
25 |
+
|
26 |
+
<table class="form-table">
|
27 |
+
<tbody>
|
28 |
+
<tr valign="top">
|
29 |
+
<th scope="row"><label for="blogname"><?php _e('Sortable Objects', 'hicpo') ?></label></th>
|
30 |
+
<td>
|
31 |
+
<?php
|
32 |
+
$post_types = get_post_types( array (
|
33 |
+
'public' => true
|
34 |
+
), 'objects' );
|
35 |
+
|
36 |
+
foreach ($post_types as $post_type ) {
|
37 |
+
if ( $post_type->name != 'attachment' ) {
|
38 |
+
?>
|
39 |
+
<label><input type="checkbox" name="objects[]" value="<?php echo $post_type->name; ?>" <?php if ( isset($objects) && is_array($objects) ) { if ( in_array($post_type->name, $objects )) { echo 'checked="checked"'; } } ?> /> <?php echo $post_type->label; ?></label><br />
|
40 |
+
<?php
|
41 |
+
}
|
42 |
+
}
|
43 |
+
?>
|
44 |
+
</td>
|
45 |
+
</tr>
|
46 |
+
</tbody>
|
47 |
+
</table>
|
48 |
+
|
49 |
+
<p class="submit">
|
50 |
+
<input type="submit" class="button-primary" name="hicpo_submit" value="<?php _e('Update', 'cptg'); ?>" />
|
51 |
+
</p>
|
52 |
+
|
53 |
+
</form>
|
54 |
+
|
55 |
+
</div>
|
intuitive-custom-post-order.php
CHANGED
@@ -2,13 +2,13 @@
|
|
2 |
/*
|
3 |
Plugin Name: Intuitive Custom Post Order
|
4 |
Plugin URI: http://hijiriworld.com/web/plugins/intuitive-custom-post-order/
|
5 |
-
Description: Intuitively, Order
|
|
|
6 |
Author: hijiri
|
7 |
Author URI: http://hijiriworld.com/web/
|
8 |
-
Version: 1.2.1
|
9 |
*/
|
10 |
|
11 |
-
/* Copyright
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License, version 2, as
|
@@ -26,105 +26,377 @@ Version: 1.2.1
|
|
26 |
|
27 |
/***************************************************************
|
28 |
|
29 |
-
|
30 |
|
31 |
***************************************************************/
|
32 |
|
33 |
-
define( '
|
34 |
|
|
|
|
|
|
|
35 |
|
36 |
/***************************************************************
|
37 |
|
38 |
-
|
39 |
|
40 |
***************************************************************/
|
41 |
|
42 |
-
|
43 |
-
function hicpo_init() {
|
44 |
-
global $custom_post_type_order, $userdata;
|
45 |
-
$custom_post_type_order = new hicpo();
|
46 |
-
}
|
47 |
-
|
48 |
|
49 |
-
class
|
50 |
-
|
51 |
-
function
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
}
|
55 |
|
56 |
-
function
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
}
|
69 |
|
70 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
71 |
global $wpdb;
|
72 |
-
|
73 |
parse_str($_POST['order'], $data);
|
|
|
74 |
if ( is_array($data) ) {
|
|
|
|
|
|
|
75 |
foreach( $data as $key => $values ) {
|
76 |
foreach( $values as $position => $id ) {
|
77 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
}
|
80 |
}
|
81 |
}
|
82 |
-
}
|
83 |
-
|
84 |
-
/***************************************************************
|
85 |
-
|
86 |
-
edit posts per page hook
|
87 |
-
|
88 |
-
***************************************************************/
|
89 |
-
|
90 |
-
add_filter( 'edit_posts_per_page', 'hicpo_edit_post_per_page' );
|
91 |
-
function hicpo_edit_post_per_page( $per_page, $post_type = null ) {
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
}
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
|
102 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
|
118 |
-
|
119 |
-
|
120 |
-
$
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
}
|
127 |
}
|
128 |
-
return $orderby;
|
129 |
}
|
|
|
|
|
130 |
?>
|
2 |
/*
|
3 |
Plugin Name: Intuitive Custom Post Order
|
4 |
Plugin URI: http://hijiriworld.com/web/plugins/intuitive-custom-post-order/
|
5 |
+
Description: Intuitively, Order Items (Posts, Pages, and Custom Post Types) using a Drag and Drop Sortable JavaScript.
|
6 |
+
Version: 2.0.7
|
7 |
Author: hijiri
|
8 |
Author URI: http://hijiriworld.com/web/
|
|
|
9 |
*/
|
10 |
|
11 |
+
/* Copyright 2013 hijiri
|
12 |
|
13 |
This program is free software; you can redistribute it and/or modify
|
14 |
it under the terms of the GNU General Public License, version 2, as
|
26 |
|
27 |
/***************************************************************
|
28 |
|
29 |
+
Define
|
30 |
|
31 |
***************************************************************/
|
32 |
|
33 |
+
define( 'HICPO_URL', plugins_url('', __FILE__) );
|
34 |
|
35 |
+
define( 'HICPO_DIR', plugin_dir_path(__FILE__) );
|
36 |
+
|
37 |
+
load_plugin_textdomain( 'hicpo', false, basename(dirname(__FILE__)).'/lang' );
|
38 |
|
39 |
/***************************************************************
|
40 |
|
41 |
+
Class & Method
|
42 |
|
43 |
***************************************************************/
|
44 |
|
45 |
+
$hicpo = new Hicpo();
|
|
|
|
|
|
|
|
|
|
|
46 |
|
47 |
+
class Hicpo
|
48 |
+
{
|
49 |
+
function __construct()
|
50 |
+
{
|
51 |
+
if ( !get_option('hicpo_options') ) $this->hicpo_install();
|
52 |
+
|
53 |
+
add_action( 'admin_menu', array( &$this, 'admin_menu') );
|
54 |
+
|
55 |
+
add_action( 'admin_init', array( &$this, 'refresh' ) );
|
56 |
+
add_action( 'admin_init', array( &$this, 'update_options') );
|
57 |
+
add_action( 'init', array( &$this, 'enable_objects' ) );
|
58 |
+
|
59 |
+
add_action( 'wp_ajax_update-menu-order', array( &$this, 'update_menu_order' ) );
|
60 |
+
|
61 |
+
// pre_get_posts
|
62 |
+
add_filter( 'pre_get_posts', array( &$this, 'hicpo_filter_active' ) );
|
63 |
+
add_filter( 'pre_get_posts', array( &$this, 'hicpo_pre_get_posts' ) );
|
64 |
+
|
65 |
+
// previous_post_link(), next_post_link()
|
66 |
+
add_filter( 'get_previous_post_where', array( &$this, 'hicpo_previous_post_where' ) );
|
67 |
+
add_filter( 'get_previous_post_sort', array( &$this, 'hicpo_previous_post_sort' ) );
|
68 |
+
add_filter( 'get_next_post_where', array( &$this, 'hocpo_next_post_where' ) );
|
69 |
+
add_filter( 'get_next_post_sort', array( &$this, 'hicpo_next_post_sort' ) );
|
70 |
}
|
71 |
|
72 |
+
function hicpo_install()
|
73 |
+
{
|
74 |
+
global $wpdb;
|
75 |
+
|
76 |
+
// Initialize : hicpo_options
|
77 |
+
|
78 |
+
$post_types = get_post_types( array (
|
79 |
+
'public' => true
|
80 |
+
), 'objects' );
|
81 |
+
|
82 |
+
foreach ($post_types as $post_type ) {
|
83 |
+
$init_objects[] = $post_type->name;
|
84 |
+
}
|
85 |
+
$input_options = array( 'objects' => $init_objects );
|
86 |
+
|
87 |
+
update_option( 'hicpo_options', $input_options );
|
88 |
+
|
89 |
+
|
90 |
+
// Initialize : menu_order from date_post
|
91 |
+
|
92 |
+
$hicpo_options = get_option( 'hicpo_options' );
|
93 |
+
$objects = $hicpo_options['objects'];
|
94 |
+
|
95 |
+
foreach( $objects as $object) {
|
96 |
+
$sql = "SELECT
|
97 |
+
ID
|
98 |
+
FROM
|
99 |
+
$wpdb->posts
|
100 |
+
WHERE
|
101 |
+
post_type = '".$object."'
|
102 |
+
AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
|
103 |
+
ORDER BY
|
104 |
+
post_date DESC
|
105 |
+
";
|
106 |
+
|
107 |
+
$results = $wpdb->get_results($sql);
|
108 |
|
109 |
+
foreach( $results as $key => $result ) {
|
110 |
+
$wpdb->update( $wpdb->posts, array( 'menu_order' => $key+1 ), array( 'ID' => $result->ID ) );
|
111 |
+
}
|
112 |
+
}
|
113 |
+
}
|
114 |
+
|
115 |
+
function admin_menu()
|
116 |
+
{
|
117 |
+
add_options_page( __('Intuitive CPO', 'hicpo'), __('Intuitive CPO', 'hicpo'), 'manage_options', 'hicpo-settings', array( &$this,'admin_page' ));
|
118 |
+
}
|
119 |
+
|
120 |
+
function admin_page()
|
121 |
+
{
|
122 |
+
require HICPO_DIR.'admin/settings.php';
|
123 |
+
}
|
124 |
+
|
125 |
+
function enable_objects()
|
126 |
+
{
|
127 |
+
$hicpo_options = get_option( 'hicpo_options' );
|
128 |
+
$objects = $hicpo_options['objects'];
|
129 |
+
|
130 |
+
if ( is_array( $objects ) ) {
|
131 |
+
$active = false;
|
132 |
+
|
133 |
+
// for Pages or Custom Post Types
|
134 |
+
if ( isset($_GET['post_type']) ) {
|
135 |
+
if ( in_array( $_GET['post_type'], $objects ) ) {
|
136 |
+
$active = true;
|
137 |
+
}
|
138 |
+
// for Posts
|
139 |
+
} else {
|
140 |
+
$post_list = strstr( $_SERVER["REQUEST_URI"], 'wp-admin/edit.php' );
|
141 |
+
if ( $post_list && in_array( 'post', $objects ) ) {
|
142 |
+
$active = true;
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
if ( $active ) {
|
147 |
+
$this->load_script_css();
|
148 |
+
}
|
149 |
}
|
150 |
}
|
151 |
|
152 |
+
function load_script_css() {
|
153 |
+
// load JavaScript
|
154 |
+
wp_enqueue_script( 'jQuery' );
|
155 |
+
wp_enqueue_script( 'jquery-ui-sortable' );
|
156 |
+
wp_enqueue_script( 'hicpojs', HICPO_URL.'/js/hicpo.js', array( 'jquery' ), null, true );
|
157 |
+
// load CSS
|
158 |
+
wp_enqueue_style( 'hicpo', HICPO_URL.'/css/hicpo.css', array(), null );
|
159 |
+
}
|
160 |
+
|
161 |
+
function refresh()
|
162 |
+
{
|
163 |
+
// menu_orderを再構築する
|
164 |
+
global $wpdb;
|
165 |
+
|
166 |
+
$hicpo_options = get_option( 'hicpo_options' );
|
167 |
+
$objects = $hicpo_options['objects'];
|
168 |
+
|
169 |
+
if ( is_array( $objects ) ) {
|
170 |
+
foreach( $objects as $object) {
|
171 |
+
$sql = "SELECT
|
172 |
+
ID
|
173 |
+
FROM
|
174 |
+
$wpdb->posts
|
175 |
+
WHERE
|
176 |
+
post_type = '".$object."'
|
177 |
+
AND post_status IN ('publish', 'pending', 'draft', 'private', 'future')
|
178 |
+
ORDER BY
|
179 |
+
menu_order ASC
|
180 |
+
";
|
181 |
+
|
182 |
+
$results = $wpdb->get_results($sql);
|
183 |
+
|
184 |
+
foreach( $results as $key => $result ) {
|
185 |
+
// 新規追加した場合「menu_order=0」で登録されるため、常に1からはじまるように振っておく
|
186 |
+
$wpdb->update( $wpdb->posts, array( 'menu_order' => $key+1 ), array( 'ID' => $result->ID ) );
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
function update_menu_order()
|
193 |
+
{
|
194 |
global $wpdb;
|
195 |
+
|
196 |
parse_str($_POST['order'], $data);
|
197 |
+
|
198 |
if ( is_array($data) ) {
|
199 |
+
|
200 |
+
// ページに含まれる記事のIDをすべて取得
|
201 |
+
$id_arr = array();
|
202 |
foreach( $data as $key => $values ) {
|
203 |
foreach( $values as $position => $id ) {
|
204 |
+
$id_arr[] = $id;
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
208 |
+
// ページに含まれる記事のmenu_orderをすべて取得
|
209 |
+
$menu_order_arr = array();
|
210 |
+
foreach( $id_arr as $key => $id ) {
|
211 |
+
$results = $wpdb->get_results("SELECT menu_order FROM $wpdb->posts WHERE ID = ".$id);
|
212 |
+
foreach( $results as $result ) {
|
213 |
+
$menu_order_arr[] = $result->menu_order;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
// menu_order配列をソート(キーと値の相関関係は維持しない)
|
217 |
+
sort($menu_order_arr);
|
218 |
+
|
219 |
+
foreach( $data as $key => $values ) {
|
220 |
+
foreach( $values as $position => $id ) {
|
221 |
+
$wpdb->update( $wpdb->posts, array( 'menu_order' => $menu_order_arr[$position] ), array( 'ID' => $id ) );
|
222 |
}
|
223 |
}
|
224 |
}
|
225 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
|
227 |
+
function update_options()
|
228 |
+
{
|
229 |
+
if ( isset( $_POST['hicpo_submit'] ) ) {
|
230 |
+
|
231 |
+
check_admin_referer( 'nonce_hicpo' );
|
232 |
+
|
233 |
+
if ( isset( $_POST['objects'] ) ) {
|
234 |
+
$input_options = array( 'objects' => $_POST['objects'] );
|
235 |
+
} else {
|
236 |
+
$input_options = array( 'objects' => '' );
|
237 |
+
}
|
238 |
+
|
239 |
+
update_option( 'hicpo_options', $input_options );
|
240 |
+
wp_redirect( 'admin.php?page=hicpo-settings&msg=update' );
|
241 |
+
}
|
242 |
}
|
243 |
+
|
244 |
+
function hicpo_previous_post_where( $where )
|
245 |
+
{
|
246 |
+
global $post;
|
247 |
|
248 |
+
$hicpo_options = get_option('hicpo_options');
|
249 |
+
$objects = $hicpo_options['objects'];
|
250 |
+
|
251 |
+
if ( in_array( $post->post_type, $objects ) ) {
|
252 |
+
$current_menu_order = $post->menu_order;
|
253 |
+
$where = "WHERE p.menu_order > '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish'";
|
254 |
+
}
|
255 |
+
return $where;
|
256 |
+
}
|
257 |
+
|
258 |
+
function hicpo_previous_post_sort( $orderby )
|
259 |
+
{
|
260 |
+
global $post;
|
261 |
|
262 |
+
$hicpo_options = get_option('hicpo_options');
|
263 |
+
$objects = $hicpo_options['objects'];
|
264 |
+
|
265 |
+
if ( in_array( $post->post_type, $objects ) ) {
|
266 |
+
$orderby = 'ORDER BY p.menu_order ASC LIMIT 1';
|
267 |
+
}
|
268 |
+
return $orderby;
|
269 |
+
}
|
270 |
+
|
271 |
+
function hocpo_next_post_where( $where )
|
272 |
+
{
|
273 |
+
global $post;
|
274 |
|
275 |
+
$hicpo_options = get_option('hicpo_options');
|
276 |
+
$objects = $hicpo_options['objects'];
|
277 |
+
|
278 |
+
if ( in_array( $post->post_type, $objects ) ) {
|
279 |
+
$current_menu_order = $post->menu_order;
|
280 |
+
$where = "WHERE p.menu_order < '".$current_menu_order."' AND p.post_type = '". $post->post_type ."' AND p.post_status = 'publish'";
|
281 |
+
}
|
282 |
+
return $where;
|
283 |
+
}
|
284 |
+
|
285 |
+
function hicpo_next_post_sort( $orderby )
|
286 |
+
{
|
287 |
+
global $post;
|
288 |
+
|
289 |
+
$hicpo_options = get_option('hicpo_options');
|
290 |
+
$objects = $hicpo_options['objects'];
|
291 |
|
292 |
+
if ( in_array( $post->post_type, $objects ) ) {
|
293 |
+
$orderby = 'ORDER BY p.menu_order DESC LIMIT 1';
|
294 |
+
}
|
295 |
+
return $orderby;
|
296 |
+
}
|
297 |
+
|
298 |
+
function hicpo_filter_active( $wp_query )
|
299 |
+
{
|
300 |
+
// get_postsの場合 suppress_filters=true となる為、フィルタリングを有効にする
|
301 |
+
if ( isset($wp_query->query['suppress_filters']) ) $wp_query->query['suppress_filters'] = false;
|
302 |
+
if ( isset($wp_query->query_vars['suppress_filters']) ) $wp_query->query_vars['suppress_filters'] = false;
|
303 |
+
return $wp_query;
|
304 |
+
}
|
305 |
|
306 |
+
function hicpo_pre_get_posts( $wp_query )
|
307 |
+
{
|
308 |
+
$hicpo_options = get_option('hicpo_options');
|
309 |
+
$objects = $hicpo_options['objects'];
|
310 |
+
|
311 |
+
if ( is_array( $objects ) ) {
|
312 |
+
|
313 |
+
// for Admin ---------------------------------------------------------------
|
314 |
+
|
315 |
+
if ( is_admin() && !defined( 'DOING_AJAX' ) ) {
|
316 |
+
|
317 |
+
// post_type=post or page or custom post type
|
318 |
+
// adminの場合、post_tyope=postも渡される
|
319 |
+
if ( isset( $wp_query->query['post_type'] ) ) {
|
320 |
+
if ( in_array( $wp_query->query['post_type'], $objects ) ) {
|
321 |
+
$wp_query->set( 'orderby', 'menu_order' );
|
322 |
+
$wp_query->set( 'order', 'ASC' );
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
// for Template ------------------------------------------------------------
|
327 |
+
|
328 |
+
} else {
|
329 |
+
|
330 |
+
$active = false;
|
331 |
+
|
332 |
+
// postsのWordpressループ ----------------
|
333 |
+
|
334 |
+
// $wp_query->queryが空配列の場合
|
335 |
+
// WordPressループでもposts以外はpost_typeが渡される
|
336 |
+
|
337 |
+
if ( empty( $wp_query->query ) ) {
|
338 |
+
if ( in_array( 'post', $objects ) ) {
|
339 |
+
$active = true;
|
340 |
+
}
|
341 |
+
} else {
|
342 |
+
|
343 |
+
// get_posts() ----------------------
|
344 |
+
|
345 |
+
// 完全な判別ではないが、suppress_filtersパラメータの有無で判別
|
346 |
+
// get_posts()の場合、post_type, orderby, orderパラメータは必ず渡される
|
347 |
+
|
348 |
+
if ( isset($wp_query->query['suppress_filters']) ) {
|
349 |
+
|
350 |
+
// post_type判定
|
351 |
+
if ( is_array( $wp_query->query['post_type'] ) ) {
|
352 |
+
$post_types = $wp_query->query['post_type'];
|
353 |
+
foreach( $post_types as $post_type ) {
|
354 |
+
if ( in_array( $post_type, $objects ) ) {
|
355 |
+
$active = true;
|
356 |
+
}
|
357 |
+
}
|
358 |
+
} else {
|
359 |
+
if ( in_array( $wp_query->query['post_type'], $objects ) ) {
|
360 |
+
$active = true;
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
// query_posts() or WP_Query()
|
365 |
+
} else {
|
366 |
+
|
367 |
+
// post_typeが指定されている場合
|
368 |
+
if ( isset( $wp_query->query['post_type'] ) ) {
|
369 |
+
|
370 |
+
// post_type判定
|
371 |
+
if ( is_array( $wp_query->query['post_type'] ) ) {
|
372 |
+
$post_types = $wp_query->query['post_type'];
|
373 |
+
foreach( $post_types as $post_type ) {
|
374 |
+
if ( in_array( $post_type, $objects ) ) {
|
375 |
+
$active = true;
|
376 |
+
}
|
377 |
+
}
|
378 |
+
} else {
|
379 |
+
if ( in_array( $wp_query->query['post_type'], $objects ) ) {
|
380 |
+
$active = true;
|
381 |
+
}
|
382 |
+
}
|
383 |
+
// post_typeが指定されてい場合はpost_type=post
|
384 |
+
} else {
|
385 |
+
if ( in_array( 'post', $objects ) ) {
|
386 |
+
$active = true;
|
387 |
+
}
|
388 |
+
}
|
389 |
+
}
|
390 |
+
}
|
391 |
+
|
392 |
+
if ( $active ) {
|
393 |
+
if ( !isset( $wp_query->query['orderby'] ) || $wp_query->query['orderby'] == 'date' ) $wp_query->set( 'orderby', 'menu_order' );
|
394 |
+
if ( !isset( $wp_query->query['order'] ) || $wp_query->query['order'] == 'DESC' ) $wp_query->set( 'order', 'ASC' );
|
395 |
+
}
|
396 |
+
}
|
397 |
}
|
398 |
}
|
|
|
399 |
}
|
400 |
+
|
401 |
+
|
402 |
?>
|
lang/default.pot
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: \n"
|
4 |
+
"POT-Creation-Date: 2013-03-05 01:46+0900\n"
|
5 |
+
"PO-Revision-Date: 2013-03-05 01:47+0900\n"
|
6 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
7 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
8 |
+
"MIME-Version: 1.0\n"
|
9 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
10 |
+
"Content-Transfer-Encoding: 8bit\n"
|
11 |
+
|
12 |
+
#: intuitive-custom-post-order/intuitive-custom-post-order.php:107
|
13 |
+
msgid "Intuitive CPO"
|
14 |
+
msgstr ""
|
15 |
+
|
16 |
+
#: intuitive-custom-post-order/admin/settings.php:12
|
17 |
+
msgid "Intuitive Custom Post Order Settings"
|
18 |
+
msgstr ""
|
19 |
+
|
20 |
+
#: intuitive-custom-post-order/admin/settings.php:17
|
21 |
+
msgid "Settings saved."
|
22 |
+
msgstr ""
|
23 |
+
|
24 |
+
#: intuitive-custom-post-order/admin/settings.php:29
|
25 |
+
msgid "Sortable Objects"
|
26 |
+
msgstr ""
|
27 |
+
|
28 |
+
#: intuitive-custom-post-order/admin/settings.php:50
|
29 |
+
msgid "Update"
|
30 |
+
msgstr ""
|
lang/hicpo-sv_SE.mo
ADDED
Binary file
|
lang/hicpo-sv_SE.po
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Intuitive Custom Post Order v2.0.6\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2013-11-23 17:40+0100\n"
|
7 |
+
"Last-Translator: Thomas Persson <info@ajfix.se>\n"
|
8 |
+
"Language-Team: \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=2; plural=n != 1;\n"
|
13 |
+
"X-Generator: Poedit 1.5.7\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: sv_SE\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
|
22 |
+
# @ hicpo
|
23 |
+
#: admin/settings.php:12
|
24 |
+
msgid "Intuitive Custom Post Order Settings"
|
25 |
+
msgstr "Intuitive CPO Inställningar"
|
26 |
+
|
27 |
+
# @ hicpo
|
28 |
+
#: admin/settings.php:17
|
29 |
+
msgid "Settings saved."
|
30 |
+
msgstr "Inställningar sparade"
|
31 |
+
|
32 |
+
# @ hicpo
|
33 |
+
#: admin/settings.php:29
|
34 |
+
msgid "Sortable Objects"
|
35 |
+
msgstr "Sorteringsbara objekt"
|
36 |
+
|
37 |
+
# @ cptg
|
38 |
+
#: admin/settings.php:50
|
39 |
+
msgid "Update"
|
40 |
+
msgstr "Uppdatera"
|
41 |
+
|
42 |
+
# @ hicpo
|
43 |
+
#: intuitive-custom-post-order.php:117
|
44 |
+
msgid "Intuitive CPO"
|
45 |
+
msgstr "Intuitive CPO"
|
readme.txt
CHANGED
@@ -1,33 +1,70 @@
|
|
1 |
=== Intuitive Custom Post Order ===
|
2 |
Contributors: hijiri
|
3 |
Tags: post order, posts order, order post, order posts, custom post type order
|
4 |
-
Requires at least: 3.
|
5 |
-
Tested up to: 3.
|
6 |
-
Stable tag:
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
-
Intuitively, Order
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
Intuitively, Order
|
15 |
Configuration is unnecessary.
|
16 |
You can do directly on default WordPress administration.
|
17 |
|
18 |
-
Excluding
|
19 |
|
20 |
== Installation ==
|
21 |
|
22 |
1. Upload 'intuitive-custom-post-order' folder to the `/wp-content/plugins/` directory
|
23 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
|
|
24 |
|
25 |
== Screenshots ==
|
26 |
|
27 |
-
1. Order
|
28 |
|
29 |
== Changelog ==
|
30 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
= 1.2.1 =
|
32 |
|
33 |
* Bug fixed
|
1 |
=== Intuitive Custom Post Order ===
|
2 |
Contributors: hijiri
|
3 |
Tags: post order, posts order, order post, order posts, custom post type order
|
4 |
+
Requires at least: 3.0.0
|
5 |
+
Tested up to: 3.8.0
|
6 |
+
Stable tag: 2.0.7
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
+
Intuitively, Order Items (Posts, Pages, and Custom Post Types) using a Drag and Drop Sortable JavaScript.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
Intuitively, Order Items (Posts, Pages, and Custom Post Types) using a Drag and Drop Sortable JavaScript.
|
15 |
Configuration is unnecessary.
|
16 |
You can do directly on default WordPress administration.
|
17 |
|
18 |
+
Excluding Custom Query which uses 'order' or 'orderby' parameters, in query_posts()', 'WP_Query()', and 'get_posts'.
|
19 |
|
20 |
== Installation ==
|
21 |
|
22 |
1. Upload 'intuitive-custom-post-order' folder to the `/wp-content/plugins/` directory
|
23 |
2. Activate the plugin through the 'Plugins' menu in WordPress
|
24 |
+
3. (Optional) Select Sortable Objects from Intuitive CPT Menu
|
25 |
|
26 |
== Screenshots ==
|
27 |
|
28 |
+
1. Order items
|
29 |
|
30 |
== Changelog ==
|
31 |
|
32 |
+
= 2.0.7 =
|
33 |
+
|
34 |
+
* Bug fixed.
|
35 |
+
for WordPress 3.8
|
36 |
+
|
37 |
+
* Add Swedish Translations.(by Thomas)
|
38 |
+
|
39 |
+
= 2.0.6 =
|
40 |
+
|
41 |
+
* ver.2.0.5 fixed.
|
42 |
+
|
43 |
+
= 2.0.5 =
|
44 |
+
|
45 |
+
* Support 'next_post_link()' and 'previous_post_link()'(single to single).
|
46 |
+
|
47 |
+
= 2.0.4 =
|
48 |
+
|
49 |
+
* Bug fixed
|
50 |
+
|
51 |
+
= 2.0.3 =
|
52 |
+
|
53 |
+
* Intuitive CPO Settings Page was moved to Settings menu.
|
54 |
+
|
55 |
+
= 2.0.2 =
|
56 |
+
|
57 |
+
* Bug fixed
|
58 |
+
|
59 |
+
= 2.0.0 =
|
60 |
+
|
61 |
+
* Select Sortable Objects. (Posts, Pages, and Custom Post Types)
|
62 |
+
* Support Pages and hierarchical Custom Post Types.
|
63 |
+
* Sortable Item's status is not only 'publish' but also other all status('pending', 'draft', 'private', 'future').
|
64 |
+
* In Paging, it's all activated normaly. So, 'screen-per-page' is User like.
|
65 |
+
* In Lists which sorted any category(Category, Tag, Taxonomy), it's all activated normaly.
|
66 |
+
* Support Child posts and Child pages. When you sort any item, Relation of parent item between it's child items is maintained.
|
67 |
+
|
68 |
= 1.2.1 =
|
69 |
|
70 |
* Bug fixed
|
screenshot-1.png
CHANGED
Binary file
|