Version Description
Download this release
Release Info
Developer | Toro_Unit |
Plugin | Custom Post Type Permalinks |
Version | 1.5.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.5.1
- CPTP.php +21 -8
- CPTP/Module.php +4 -0
- CPTP/Module/Permalink.php +8 -0
- CPTP/Module/Rewrite.php +2 -2
- custom-post-type-permalinks.php +2 -2
- readme.txt +2 -2
CPTP.php
CHANGED
@@ -29,24 +29,37 @@ class CPTP {
|
|
29 |
*
|
30 |
*/
|
31 |
private function load_modules() {
|
32 |
-
$this->
|
33 |
-
$this->
|
34 |
-
$this->
|
35 |
-
$this->
|
36 |
-
$this->
|
37 |
-
$this->
|
38 |
-
$this->
|
39 |
|
40 |
do_action( 'CPTP_load_modules', $this );
|
41 |
|
42 |
foreach ( $this->modules as $module ) {
|
43 |
-
$module->
|
44 |
}
|
45 |
|
46 |
do_action( 'CPTP_registered_modules', $this );
|
47 |
|
48 |
}
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
/**
|
51 |
* init
|
52 |
*
|
29 |
*
|
30 |
*/
|
31 |
private function load_modules() {
|
32 |
+
$this->set_module( 'setting', new CPTP_Module_Setting() );
|
33 |
+
$this->set_module( 'rewrite', new CPTP_Module_Rewrite() );
|
34 |
+
$this->set_module( 'admin', new CPTP_Module_Admin() );
|
35 |
+
$this->set_module( 'option', new CPTP_Module_Option() );
|
36 |
+
$this->set_module( 'permalink', new CPTP_Module_Permalink() );
|
37 |
+
$this->set_module( 'get_archives', new CPTP_Module_GetArchives() );
|
38 |
+
$this->set_module( 'flush_rules', new CPTP_Module_FlushRules() );
|
39 |
|
40 |
do_action( 'CPTP_load_modules', $this );
|
41 |
|
42 |
foreach ( $this->modules as $module ) {
|
43 |
+
$module->init();
|
44 |
}
|
45 |
|
46 |
do_action( 'CPTP_registered_modules', $this );
|
47 |
|
48 |
}
|
49 |
|
50 |
+
/**
|
51 |
+
* set module.
|
52 |
+
*
|
53 |
+
* @since 1.5.0
|
54 |
+
*
|
55 |
+
* @param $name
|
56 |
+
* @param CPTP_Module $module
|
57 |
+
*/
|
58 |
+
public function set_module( $name, CPTP_Module $module ) {
|
59 |
+
|
60 |
+
$this->modules[ $name ] = apply_filters( "CPTP_set_{$name}_module", $module );
|
61 |
+
}
|
62 |
+
|
63 |
/**
|
64 |
* init
|
65 |
*
|
CPTP/Module.php
CHANGED
@@ -3,6 +3,10 @@
|
|
3 |
|
4 |
Abstract Class CPTP_Module {
|
5 |
|
|
|
|
|
|
|
|
|
6 |
public function register() {
|
7 |
add_action( 'CPTP_init', array( $this, 'add_hook' ) );
|
8 |
}
|
3 |
|
4 |
Abstract Class CPTP_Module {
|
5 |
|
6 |
+
final public function init() {
|
7 |
+
$this->register();
|
8 |
+
}
|
9 |
+
|
10 |
public function register() {
|
11 |
add_action( 'CPTP_init', array( $this, 'add_hook' ) );
|
12 |
}
|
CPTP/Module/Permalink.php
CHANGED
@@ -226,6 +226,14 @@ class CPTP_Module_Permalink extends CPTP_Module {
|
|
226 |
return array( 'search' => $search, 'replace' => $replace );
|
227 |
}
|
228 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
229 |
private static function get_term_parent( $term ) {
|
230 |
if ( isset( $term->parent ) and $term->parent > 0 ) {
|
231 |
return $term->parent;
|
226 |
return array( 'search' => $search, 'replace' => $replace );
|
227 |
}
|
228 |
|
229 |
+
/**
|
230 |
+
*
|
231 |
+
* get parent from term Object
|
232 |
+
*
|
233 |
+
* @param WP_Term|stdClass $term
|
234 |
+
*
|
235 |
+
* @return mixed
|
236 |
+
*/
|
237 |
private static function get_term_parent( $term ) {
|
238 |
if ( isset( $term->parent ) and $term->parent > 0 ) {
|
239 |
return $term->parent;
|
CPTP/Module/Rewrite.php
CHANGED
@@ -12,9 +12,9 @@
|
|
12 |
* */
|
13 |
class CPTP_Module_Rewrite extends CPTP_Module {
|
14 |
|
15 |
-
/** @var
|
16 |
private $post_type_args;
|
17 |
-
/** @var
|
18 |
private $taxonomy_args;
|
19 |
|
20 |
public function add_hook() {
|
12 |
* */
|
13 |
class CPTP_Module_Rewrite extends CPTP_Module {
|
14 |
|
15 |
+
/** @var array */
|
16 |
private $post_type_args;
|
17 |
+
/** @var array */
|
18 |
private $taxonomy_args;
|
19 |
|
20 |
public function add_hook() {
|
custom-post-type-permalinks.php
CHANGED
@@ -5,7 +5,7 @@ Plugin URI: http://www.torounit.com
|
|
5 |
Description: Add post archives of custom post type and customizable permalinks.
|
6 |
Author: Toro_Unit
|
7 |
Author URI: http://www.torounit.com/plugins/custom-post-type-permalinks/
|
8 |
-
Version: 1.
|
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 1.
|
21 |
*
|
22 |
*/
|
23 |
|
5 |
Description: Add post archives of custom post type and customizable permalinks.
|
6 |
Author: Toro_Unit
|
7 |
Author URI: http://www.torounit.com/plugins/custom-post-type-permalinks/
|
8 |
+
Version: 1.5.1
|
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 1.5.1
|
21 |
*
|
22 |
*/
|
23 |
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: Toro_Unit,inc2734,ixkaito,keita_kobayashi
|
|
3 |
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.
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or Later
|
9 |
|
10 |
Edit the permalink of custom post type.
|
3 |
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.5
|
7 |
+
Stable tag: 1.5.1
|
8 |
License: GPLv2 or Later
|
9 |
|
10 |
Edit the permalink of custom post type.
|