Version Description
Download this release
Release Info
Developer | Toro_Unit |
Plugin | Custom Post Type Permalinks |
Version | 2.2.0 |
Comparing to | |
See all releases |
Code changes from version 2.1.3 to 2.2.0
- CPTP/Module/Admin.php +5 -4
- CPTP/Module/Permalink.php +1 -1
- CPTP/Module/Rewrite.php +5 -2
- CPTP/Util.php +10 -0
- custom-post-type-permalinks.php +2 -2
- readme.txt +1 -1
CPTP/Module/Admin.php
CHANGED
@@ -116,7 +116,8 @@ class CPTP_Module_Admin extends CPTP_Module {
|
|
116 |
|
117 |
|
118 |
public function setting_no_tax_structure_callback_function() {
|
119 |
-
|
|
|
120 |
$txt = __( "If you check this, the custom taxonomy's permalinks will be <code>%s/post_type/taxonomy/term</code>.", 'custom-post-type-permalinks' );
|
121 |
echo sprintf( wp_kses( $txt, array( 'code' => array() ) ), esc_html( home_url() ) );
|
122 |
}
|
@@ -148,10 +149,10 @@ class CPTP_Module_Admin extends CPTP_Module {
|
|
148 |
wp_enqueue_script( 'wp-pointer' );
|
149 |
wp_enqueue_script( 'custom-post-type-permalinks-pointer', plugins_url( 'assets/settings-pointer.js', CPTP_PLUGIN_FILE ), array( 'wp-pointer' ), CPTP_VERSION );
|
150 |
|
151 |
-
wp_localize_script('custom-post-type-permalinks-pointer', 'CPTP_Settings_Pointer', array(
|
152 |
'content' => $content,
|
153 |
-
'name'
|
154 |
-
));
|
155 |
}
|
156 |
}
|
157 |
}
|
116 |
|
117 |
|
118 |
public function setting_no_tax_structure_callback_function() {
|
119 |
+
$no_taxonomy_structure = CPTP_Util::get_no_taxonomy_structure();
|
120 |
+
echo '<input name="no_taxonomy_structure" id="no_taxonomy_structure" type="checkbox" value="1" class="code" ' . checked( false, $no_taxonomy_structure, false ) . ' /> ';
|
121 |
$txt = __( "If you check this, the custom taxonomy's permalinks will be <code>%s/post_type/taxonomy/term</code>.", 'custom-post-type-permalinks' );
|
122 |
echo sprintf( wp_kses( $txt, array( 'code' => array() ) ), esc_html( home_url() ) );
|
123 |
}
|
149 |
wp_enqueue_script( 'wp-pointer' );
|
150 |
wp_enqueue_script( 'custom-post-type-permalinks-pointer', plugins_url( 'assets/settings-pointer.js', CPTP_PLUGIN_FILE ), array( 'wp-pointer' ), CPTP_VERSION );
|
151 |
|
152 |
+
wp_localize_script( 'custom-post-type-permalinks-pointer', 'CPTP_Settings_Pointer', array(
|
153 |
'content' => $content,
|
154 |
+
'name' => $pointer_name,
|
155 |
+
) );
|
156 |
}
|
157 |
}
|
158 |
}
|
CPTP/Module/Permalink.php
CHANGED
@@ -314,7 +314,7 @@ class CPTP_Module_Permalink extends CPTP_Module {
|
|
314 |
return $termlink;
|
315 |
}
|
316 |
|
317 |
-
if (
|
318 |
return $termlink;
|
319 |
}
|
320 |
|
314 |
return $termlink;
|
315 |
}
|
316 |
|
317 |
+
if ( CPTP_Util::get_no_taxonomy_structure() ) {
|
318 |
return $termlink;
|
319 |
}
|
320 |
|
CPTP/Module/Rewrite.php
CHANGED
@@ -119,14 +119,17 @@ class CPTP_Module_Rewrite extends CPTP_Module {
|
|
119 |
*
|
120 |
* @param string $taxonomy
|
121 |
* @param array|string $object_type
|
122 |
-
* @param array $args
|
123 |
*
|
124 |
* @return void
|
125 |
*/
|
126 |
public function register_taxonomy_rules( $taxonomy, $object_type, $args ) {
|
127 |
global $wp_rewrite;
|
128 |
|
129 |
-
|
|
|
|
|
|
|
130 |
return;
|
131 |
}
|
132 |
|
119 |
*
|
120 |
* @param string $taxonomy
|
121 |
* @param array|string $object_type
|
122 |
+
* @param array|WP_Taxonomy $args
|
123 |
*
|
124 |
* @return void
|
125 |
*/
|
126 |
public function register_taxonomy_rules( $taxonomy, $object_type, $args ) {
|
127 |
global $wp_rewrite;
|
128 |
|
129 |
+
/* for 4.7 */
|
130 |
+
$args = (array) $args;
|
131 |
+
|
132 |
+
if ( CPTP_Util::get_no_taxonomy_structure() ) {
|
133 |
return;
|
134 |
}
|
135 |
|
CPTP/Util.php
CHANGED
@@ -176,4 +176,14 @@ class CPTP_Util {
|
|
176 |
return $front;
|
177 |
|
178 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
179 |
}
|
176 |
return $front;
|
177 |
|
178 |
}
|
179 |
+
|
180 |
+
/**
|
181 |
+
* Get Option no_taxonomy_structure.
|
182 |
+
*
|
183 |
+
* @since 2.2.0
|
184 |
+
* @return bool
|
185 |
+
*/
|
186 |
+
public static function get_no_taxonomy_structure() {
|
187 |
+
return ! ! intval( get_option( 'no_taxonomy_structure', true ) );
|
188 |
+
}
|
189 |
}
|
custom-post-type-permalinks.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://github.com/torounit/custom-post-type-permalinks
|
|
5 |
Description: Add post archives of custom post type and customizable permalinks.
|
6 |
Author: Toro_Unit
|
7 |
Author URI: https://torounit.com/
|
8 |
-
Version: 2.
|
9 |
Text Domain: custom-post-type-permalinks
|
10 |
License: GPL2 or later
|
11 |
Domain Path: /language/
|
@@ -17,7 +17,7 @@ Domain Path: /language/
|
|
17 |
* Custom Post Type Permalinks
|
18 |
*
|
19 |
* @package Custom_Post_Type_Permalinks
|
20 |
-
* @version 2.
|
21 |
*/
|
22 |
|
23 |
define( 'CPTP_PLUGIN_FILE', __FILE__ );
|
5 |
Description: Add post archives of custom post type and customizable permalinks.
|
6 |
Author: Toro_Unit
|
7 |
Author URI: https://torounit.com/
|
8 |
+
Version: 2.2.0
|
9 |
Text Domain: custom-post-type-permalinks
|
10 |
License: GPL2 or later
|
11 |
Domain Path: /language/
|
17 |
* Custom Post Type Permalinks
|
18 |
*
|
19 |
* @package Custom_Post_Type_Permalinks
|
20 |
+
* @version 2.2.0
|
21 |
*/
|
22 |
|
23 |
define( 'CPTP_PLUGIN_FILE', __FILE__ );
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.amazon.co.jp/registry/wishlist/COKSXS25MVQV
|
|
4 |
Tags: permalink,permalinks,custom post type,custom taxonomy,cms
|
5 |
Requires at least: 4.3
|
6 |
Tested up to: 4.6
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or Later
|
9 |
|
10 |
Edit the permalink of custom post type.
|
4 |
Tags: permalink,permalinks,custom post type,custom taxonomy,cms
|
5 |
Requires at least: 4.3
|
6 |
Tested up to: 4.6
|
7 |
+
Stable tag: 2.2.0
|
8 |
License: GPLv2 or Later
|
9 |
|
10 |
Edit the permalink of custom post type.
|