Version Description
- Add filter
cptp_post_type_link_priority
,cptp_term_link_priority
,cptp_attachment_link_priority
. - Add action
CPTP_registered_modules
.
Download this release
Release Info
Developer | Toro_Unit |
Plugin | Custom Post Type Permalinks |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.0 to 1.2.0
- CPTP.php +18 -12
- CPTP/Module.php +1 -1
- CPTP/Module/Permalink.php +24 -3
- custom-post-type-permalinks.php +2 -2
- readme.md +5 -0
- readme.txt +5 -1
CPTP.php
CHANGED
@@ -9,13 +9,13 @@
|
|
9 |
* @since 0.9.4
|
10 |
*
|
11 |
* */
|
12 |
-
|
13 |
-
|
14 |
class CPTP {
|
15 |
|
16 |
-
|
17 |
private static $_instance;
|
18 |
|
|
|
|
|
|
|
19 |
private function __construct() {
|
20 |
$this->load_modules();
|
21 |
$this->init();
|
@@ -29,14 +29,21 @@ class CPTP {
|
|
29 |
*
|
30 |
*/
|
31 |
private function load_modules() {
|
32 |
-
new CPTP_Module_Setting();
|
33 |
-
new CPTP_Module_Rewrite();
|
34 |
-
new CPTP_Module_Admin();
|
35 |
-
new CPTP_Module_Option();
|
36 |
-
new CPTP_Module_Permalink();
|
37 |
-
new CPTP_Module_GetArchives();
|
38 |
-
new CPTP_Module_FlushRules();
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
}
|
42 |
|
@@ -66,5 +73,4 @@ class CPTP {
|
|
66 |
}
|
67 |
|
68 |
|
69 |
-
|
70 |
}
|
9 |
* @since 0.9.4
|
10 |
*
|
11 |
* */
|
|
|
|
|
12 |
class CPTP {
|
13 |
|
|
|
14 |
private static $_instance;
|
15 |
|
16 |
+
/** @var CPTP_Module[] */
|
17 |
+
public $modules;
|
18 |
+
|
19 |
private function __construct() {
|
20 |
$this->load_modules();
|
21 |
$this->init();
|
29 |
*
|
30 |
*/
|
31 |
private function load_modules() {
|
32 |
+
$this->modules['setting'] = new CPTP_Module_Setting();
|
33 |
+
$this->modules['rewrite'] = new CPTP_Module_Rewrite();
|
34 |
+
$this->modules['admin'] = new CPTP_Module_Admin();
|
35 |
+
$this->modules['option'] = new CPTP_Module_Option();
|
36 |
+
$this->modules['permalink'] = new CPTP_Module_Permalink();
|
37 |
+
$this->modules['get_archives'] = new CPTP_Module_GetArchives();
|
38 |
+
$this->modules['flush_rules'] = new CPTP_Module_FlushRules();
|
39 |
+
|
40 |
+
do_action( 'CPTP_load_modules', $this );
|
41 |
+
|
42 |
+
foreach ( $this->modules as $module ) {
|
43 |
+
$module->register();
|
44 |
+
}
|
45 |
+
|
46 |
+
do_action( 'CPTP_registered_modules', $this );
|
47 |
|
48 |
}
|
49 |
|
73 |
}
|
74 |
|
75 |
|
|
|
76 |
}
|
CPTP/Module.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
|
4 |
Abstract Class CPTP_Module {
|
5 |
|
6 |
-
public function
|
7 |
add_action( 'CPTP_init', array( $this, 'add_hook' ) );
|
8 |
}
|
9 |
|
3 |
|
4 |
Abstract Class CPTP_Module {
|
5 |
|
6 |
+
public function register() {
|
7 |
add_action( 'CPTP_init', array( $this, 'add_hook' ) );
|
8 |
}
|
9 |
|
CPTP/Module/Permalink.php
CHANGED
@@ -13,10 +13,31 @@
|
|
13 |
class CPTP_Module_Permalink extends CPTP_Module {
|
14 |
|
15 |
|
|
|
|
|
|
|
16 |
public function add_hook() {
|
17 |
-
|
18 |
-
add_filter(
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
|
22 |
|
13 |
class CPTP_Module_Permalink extends CPTP_Module {
|
14 |
|
15 |
|
16 |
+
/**
|
17 |
+
* Add Filter Hooks.
|
18 |
+
*/
|
19 |
public function add_hook() {
|
20 |
+
|
21 |
+
add_filter(
|
22 |
+
'post_type_link',
|
23 |
+
array( $this, 'post_type_link' ),
|
24 |
+
apply_filters( 'cptp_post_type_link_priority', 0 ),
|
25 |
+
4
|
26 |
+
);
|
27 |
+
|
28 |
+
add_filter(
|
29 |
+
'term_link',
|
30 |
+
array( $this, 'term_link' ),
|
31 |
+
apply_filters( 'cptp_term_link_priority', 0 ),
|
32 |
+
3
|
33 |
+
);
|
34 |
+
|
35 |
+
add_filter(
|
36 |
+
'attachment_link',
|
37 |
+
array( $this, 'attachment_link' ),
|
38 |
+
apply_filters( 'cptp_attachment_link_priority', 20 ),
|
39 |
+
2
|
40 |
+
);
|
41 |
}
|
42 |
|
43 |
|
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: cptp
|
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.2.0
|
9 |
Text Domain: cptp
|
10 |
License: GPL2 or later
|
11 |
Domain Path: /language/
|
17 |
* Custom Post Type Permalinks
|
18 |
*
|
19 |
* @package Custom_Post_Type_Permalinks
|
20 |
+
* @version 1.2.0
|
21 |
*
|
22 |
*/
|
23 |
|
readme.md
CHANGED
@@ -65,6 +65,11 @@ That's it. You can access the permalinks setting by going to *Settings -> Permal
|
|
65 |
|
66 |
## Changelog
|
67 |
|
|
|
|
|
|
|
|
|
|
|
68 |
### 1.1.0
|
69 |
|
70 |
* WPML Test. thanks [keita_kobayashi](https://profiles.wordpress.org/keita_kobayashi) !
|
65 |
|
66 |
## Changelog
|
67 |
|
68 |
+
### 1.2.0
|
69 |
+
|
70 |
+
* Add filter `cptp_post_type_link_priority`, `cptp_term_link_priority`, `cptp_attachment_link_priority`.
|
71 |
+
* Add action `CPTP_registered_modules`.
|
72 |
+
|
73 |
### 1.1.0
|
74 |
|
75 |
* WPML Test. thanks [keita_kobayashi](https://profiles.wordpress.org/keita_kobayashi) !
|
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.1
|
6 |
Tested up to: 4.3
|
7 |
-
Stable tag: 1.
|
8 |
License: GPLv2 or Later
|
9 |
|
10 |
Edit the permalink of custom post type.
|
@@ -61,6 +61,10 @@ That's it. You can access the permalinks setting by going to *Settings -> Permal
|
|
61 |
|
62 |
== Changelog ==
|
63 |
|
|
|
|
|
|
|
|
|
64 |
= 1.1.0 =
|
65 |
* WPML Test. thanks [keita_kobayashi](https://profiles.wordpress.org/keita_kobayashi) !
|
66 |
|
4 |
Tags: permalink,permalinks,custom post type,custom taxonomy,cms
|
5 |
Requires at least: 4.1
|
6 |
Tested up to: 4.3
|
7 |
+
Stable tag: 1.2.0
|
8 |
License: GPLv2 or Later
|
9 |
|
10 |
Edit the permalink of custom post type.
|
61 |
|
62 |
== Changelog ==
|
63 |
|
64 |
+
= 1.2.0 =
|
65 |
+
* Add filter `cptp_post_type_link_priority`, `cptp_term_link_priority`, `cptp_attachment_link_priority`.
|
66 |
+
* Add action `CPTP_registered_modules`.
|
67 |
+
|
68 |
= 1.1.0 =
|
69 |
* WPML Test. thanks [keita_kobayashi](https://profiles.wordpress.org/keita_kobayashi) !
|
70 |
|