PluginProbe ʕ •ᴥ•ʔ
Custom Post Type Permalinks / 0.7.6
Custom Post Type Permalinks v0.7.6
1.2.0 1.3.0 1.3.1 1.4.0 1.5.1 1.5.2 1.5.4 2.0.0 2.0.1 2.0.2 2.1.1 2.1.2 2.1.3 2.2.0 3.0.0 3.0.1 3.1.0 3.1.1 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.3.0 3.3.1 3.3.4 3.3.5 3.4.0 3.4.0-rc.1 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.5.2 3.5.3 3.5.4 3.5.5 trunk 0.6 0.6.1 0.6.2 0.7 0.7.1 0.7.10 0.7.2 0.7.2.1 0.7.3 0.7.3.1 0.7.4 0.7.4.1 0.7.5 0.7.5.1 0.7.5.2 0.7.5.6 0.7.6 0.7.8 0.7.9 0.7.9.1 0.7.9.2 0.8 0.8.1 0.8.6 0.8.7 0.8.7.1 0.8.7.5 0.8.7.6 0.9 0.9.1 0.9.2.1 0.9.3.1 0.9.3.2 0.9.3.3 0.9.5 0.9.5.1 0.9.5.2 0.9.5.3 0.9.5.4 0.9.5.6 0.9.6 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0
custom-post-type-permalinks / custom-post-type-permalinks.php
custom-post-type-permalinks Last commit date
cptp-ja.mo 14 years ago cptp-ja.po 14 years ago custom-post-type-permalinks.php 14 years ago readme.txt 14 years ago screenshot-1.png 14 years ago
custom-post-type-permalinks.php
422 lines
1 <?php
2 /*
3 Plugin Name: Custom Post Type Permalinks
4 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: 0.7.6
9 Text Domain: cptp
10 Domain Path: /
11 */
12
13
14
15 /* Copyright 2011 Toro_Unit (email : mail@torounit.com)
16
17 This program is free software; you can redistribute it and/or modify
18 it under the terms of the GNU General Public License as published by
19 the Free Software Foundation; either version 2 of the License, or
20 (at your option) any later version.
21
22 This program is distributed in the hope that it will be useful,
23 but WITHOUT ANY WARRANTY; without even the implied warranty of
24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 GNU General Public License for more details.
26
27 You should have received a copy of the GNU General Public License
28 along with this program; if not, write to the Free Software
29 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 */
31
32 /* This plugin don't support Multisite yet.*/
33
34
35 class Custom_Post_Type_Permalinks {
36
37 static public $default_structure = '/%year%/%monthnum%/%day%/%post_id%/';
38
39 public function __construct () {
40 add_action('wp_loaded',array(&$this,'set_archive_rewrite'),99);
41 add_action('wp_loaded', array(&$this,'set_rewrite'),100);
42 add_action('wp_loaded', array(&$this,'add_tax_rewrite'));
43
44 if(get_option("permalink_structure") != "") {
45 add_filter('post_type_link', array(&$this,'set_permalink'),10,3);
46
47 add_filter('getarchives_where', array(&$this,'get_archives_where'), 10, 2);
48 add_filter('get_archives_link', array(&$this,'get_archives_link'));
49 add_filter('term_link', array(&$this,'set_term_link'),10,3);
50 }
51 }
52
53 public function get_taxonomy_parents( $id, $taxonomy = 'category', $link = false, $separator = '/', $nicename = false, $visited = array() ) {
54 $chain = '';
55 $parent = &get_term( $id, $taxonomy, OBJECT, 'raw');
56 if ( is_wp_error( $parent ) ) {
57 return $parent;
58 }
59
60 if ( $nicename ){
61 $name = $parent->slug;
62 }else {
63 $name = $parent->name;
64 }
65
66 if ( $parent->parent && ( $parent->parent != $parent->term_id ) && !in_array( $parent->parent, $visited ) ) {
67 $visited[] = $parent->parent;
68 $chain .= $this->get_taxonomy_parents( $parent->parent, $taxonomy, $link, $separator, $nicename, $visited );
69 }
70
71 if ( $link ) {
72 $chain .= '<a href="' . get_term_link( $parent->term_id, $taxonomy ) . '" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $parent->name ) ) . '">'.$name.'</a>' . $separator;
73 }else {
74 $chain .= $name.$separator;
75 }
76 return $chain;
77 }
78
79 public function set_archive_rewrite() {
80 $post_types = get_post_types( array('_builtin'=>false, 'publicly_queryable'=>true,'show_ui' => true) );
81
82 foreach ( $post_types as $post_type ):
83 if( !$post_type ) continue;
84 $permalink = get_option( $post_type.'_structure' );
85 $slug = get_post_type_object($post_type)->rewrite['slug'];
86
87 add_rewrite_rule( $slug.'/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]&post_type='.$post_type, 'top' );
88 add_rewrite_rule( $slug.'/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]&post_type='.$post_type, 'top' );
89 add_rewrite_rule( $slug.'/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]&post_type='.$post_type, 'top' );
90 add_rewrite_rule( $slug.'/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&post_type='.$post_type, 'top' );
91 add_rewrite_rule( $slug.'/date/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]&post_type='.$post_type, 'top' );
92 add_rewrite_rule( $slug.'/date/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]&post_type='.$post_type, 'top' );
93 add_rewrite_rule( $slug.'/date/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]&post_type='.$post_type, 'top' );
94 add_rewrite_rule( $slug.'/date/([0-9]{4})/([0-9]{1,2})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&post_type='.$post_type, 'top' );
95 add_rewrite_rule( $slug.'/date/([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&feed=$matches[2]&post_type='.$post_type, 'top' );
96 add_rewrite_rule( $slug.'/date/([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&feed=$matches[2]&post_type='.$post_type, 'top' );
97 add_rewrite_rule( $slug.'/date/([0-9]{4})/page/?([0-9]{1,})/?$', 'index.php?year=$matches[1]&paged=$matches[2]&post_type='.$post_type, 'top' );
98 add_rewrite_rule( $slug.'/date/([0-9]{4})/?$', 'index.php?year=$matches[1]&post_type='.$post_type, 'top' );
99 add_rewrite_rule( $slug.'/author/([^/]+)/?$', 'index.php?author=$matches[1]&post_type='.$post_type, 'top' );
100 add_rewrite_rule( $slug.'/?$', 'index.php?post_type='.$post_type, 'top' );
101
102 if( $slug != $post_type ){
103 add_rewrite_rule( $post_type.'/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]&post_type='.$post_type, 'top' );
104 add_rewrite_rule( $post_type.'/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&feed=$matches[4]&post_type='.$post_type, 'top' );
105 add_rewrite_rule( $post_type.'/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&paged=$matches[4]&post_type='.$post_type, 'top' );
106 add_rewrite_rule( $post_type.'/date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&day=$matches[3]&post_type='.$post_type, 'top' );
107 add_rewrite_rule( $post_type.'/date/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]&post_type='.$post_type, 'top' );
108 add_rewrite_rule( $post_type.'/date/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&feed=$matches[3]&post_type='.$post_type, 'top' );
109 add_rewrite_rule( $post_type.'/date/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&paged=$matches[3]&post_type='.$post_type, 'top' );
110 add_rewrite_rule( $post_type.'/date/([0-9]{4})/([0-9]{1,2})/?$', 'index.php?year=$matches[1]&monthnum=$matches[2]&post_type='.$post_type, 'top' );
111 add_rewrite_rule( $post_type.'/date/([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&feed=$matches[2]&post_type='.$post_type, 'top' );
112 add_rewrite_rule( $post_type.'/date/([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$', 'index.php?year=$matches[1]&feed=$matches[2]&post_type='.$post_type, 'top' );
113 add_rewrite_rule( $post_type.'/date/([0-9]{4})/page/?([0-9]{1,})/?$', 'index.php?year=$matches[1]&paged=$matches[2]&post_type='.$post_type, 'top' );
114 add_rewrite_rule( $post_type.'/date/([0-9]{4})/?$', 'index.php?year=$matches[1]&post_type='.$post_type, 'top' );
115 add_rewrite_rule( $post_type.'/author/([0-9]{4})/?$', 'index.php?author=$matches[1]&post_type='.$post_type, 'top' );
116 add_rewrite_rule( $post_type.'/?$', 'index.php?post_type='.$post_type, 'top' );
117 }
118 endforeach;
119 }
120
121 public function set_rewrite() {
122 global $wp_rewrite;
123
124 $post_types = get_post_types( array('_builtin'=>false, 'publicly_queryable'=>true,'show_ui' => true) );
125 foreach ( $post_types as $post_type ):
126 $permalink = get_option( $post_type.'_structure' );
127
128 if( !$permalink )
129 $permalink = self::$default_structure;
130
131 $permalink = str_replace( '%postname%', '%'.$post_type.'%', $permalink );
132 $permalink = str_replace( '%post_id%', '%'.$post_type.'_id%', $permalink );
133
134 $slug = get_post_type_object($post_type)->rewrite['slug'];
135
136 if( !$slug )
137 $slug = $post_type;
138
139 $permalink = '/'.$slug.'/'.$permalink;
140 $permalink = $permalink.'/%'.$post_type.'_page%';
141 $permalink = str_replace( '//', '/', $permalink );
142
143 $wp_rewrite->add_rewrite_tag( '%post_type%', '([^/]+)', 'post_type=' );
144 $wp_rewrite->add_rewrite_tag( '%'.$post_type.'_id%', '([0-9]{1,})','post_type='.$post_type.'&p=' );
145 $wp_rewrite->add_rewrite_tag( '%'.$post_type.'_page%', '/?([0-9]{1,}?)/?',"page=" );
146 $wp_rewrite->add_permastruct( $post_type, $permalink, false );
147
148 endforeach;
149
150 $taxonomies = get_taxonomies( array("show_ui" => true, "_builtin" => false), 'objects' );
151 foreach ( $taxonomies as $taxonomy => $objects ):
152 $wp_rewrite->add_rewrite_tag( "%$taxonomy%", '(.+?)', "$taxonomy=" );
153 endforeach;
154
155 $wp_rewrite->use_verbose_page_rules = true;
156 }
157
158 public function set_permalink( $post_link, $post,$leavename ) {
159 global $wp_rewrite;
160 $draft_or_pending = isset( $post->post_status ) && in_array( $post->post_status, array( 'draft', 'pending', 'auto-draft' ) );
161 if( $draft_or_pending and !$leavename )
162 return $post_link;
163
164 $post_type = $post->post_type;
165 $permalink = $wp_rewrite->get_extra_permastruct( $post_type );
166
167 $permalink = str_replace( '%post_type%', $post->post_type, $permalink );
168 $permalink = str_replace( '%'.$post_type.'_id%', $post->ID, $permalink );
169 $permalink = str_replace( '%'.$post_type.'_page%', "", $permalink );
170
171 $parentsDirs = "";
172 $postId = $post->ID;
173 while ($parent = get_post($postId)->post_parent) {
174 $parentsDirs = get_post($parent)->post_name."/".$parentsDirs;
175 $postId = $parent;
176 }
177
178 $permalink = str_replace( '%'.$post_type.'%', $parentsDirs.'%'.$post_type.'%', $permalink );
179
180
181 if( !$leavename ){
182
183 $permalink = str_replace( '%'.$post_type.'%', $post->post_name, $permalink );
184 }
185
186
187 $taxonomies = get_taxonomies( array('show_ui' => true),'objects' );
188
189 foreach ( $taxonomies as $taxonomy => $objects ) {
190
191 if ( strpos($permalink, "%$taxonomy%") !== false ) {
192 $terms = get_the_terms( $post->ID, $taxonomy );
193
194 if ( $terms ) {
195 usort($terms, '_usort_terms_by_ID'); // order by ID
196 $term = $terms[0]->slug;
197
198 if ( $parent = $terms[0]->parent )
199 $term = $this->get_taxonomy_parents( $parent,$taxonomy, false, '/', true ) . $term;
200 }
201
202 if(isset($term)) {
203 $permalink = str_replace( "%$taxonomy%", $term, $permalink );
204 }
205 }
206 }
207
208 $user = get_userdata( $post->post_author );
209 $permalink = str_replace( "%author%", $user->user_nicename, $permalink );
210
211 $post_date = strtotime( $post->post_date );
212 $permalink = str_replace( "%year%", date("Y",$post_date), $permalink );
213 $permalink = str_replace( "%monthnum%", date("m",$post_date), $permalink );
214 $permalink = str_replace( "%day%", date("d",$post_date), $permalink );
215 $permalink = str_replace( "%hour%", date("H",$post_date), $permalink );
216 $permalink = str_replace( "%minute%", date("i",$post_date), $permalink );
217 $permalink = str_replace( "%second%", date("s",$post_date), $permalink );
218
219 $permalink = str_replace('//', "/", $permalink );
220
221 $permalink = home_url( user_trailingslashit( $permalink ) );
222 $str = rtrim( preg_replace("/%[a-z,_]*%/","",get_option("permalink_structure")) ,'/');
223 return $permalink = str_replace($str, "", $permalink );
224
225 }
226
227 /**
228 *wp_get_archives fix for custom post
229 *Ex:wp_get_archives('&post_type='.get_query_var( 'post_type' ));
230 */
231
232 public $get_archives_where_r;
233
234 public function get_archives_where( $where, $r ) {
235 $this->get_archives_where_r = $r;
236
237 if ( isset($r['post_type']) )
238 $where = str_replace( '\'post\'', '\'' . $r['post_type'] . '\'', $where );
239
240 return $where;
241 }
242
243 function get_archives_link( $link_html ) {
244 //$slug = get_post_type_object($this->get_archives_where_r['post_type'])->rewrite['slug'];
245 if (isset($this->get_archives_where_r['post_type']) and $this->get_archives_where_r['type'] != 'postbypost'){
246 $blog_url = get_bloginfo("url");
247 if($str = rtrim( preg_replace("/%[a-z,_]*%/","",get_option("permalink_structure")) ,'/')) {
248 $link_html = str_replace($str, '/'.$this->get_archives_where_r['post_type'], $link_html);
249 }else{
250 $blog_url = rtrim($blog_url,"/");
251 $link_html = str_replace($blog_url,$blog_url.'/'.$this->get_archives_where_r['post_type'].'/date',$link_html);
252 }
253 }
254
255 return $link_html;
256 }
257
258 /**
259 * fix permalink custom taxonomy
260 */
261 public function add_tax_rewrite() {
262 if(get_option('no_taxonomy_structure'))
263 return false;
264
265 global $wp_rewrite;
266 $taxonomies = get_taxonomies(array( '_builtin' => false));
267 if(empty($taxonomies))
268 return false;
269
270 foreach ($taxonomies as $taxonomy) :
271 $post_types = get_taxonomy($taxonomy)->object_type;
272
273 foreach ($post_types as $post_type):
274 $slug = get_post_type_object($post_type)->rewrite["slug"];
275 //add taxonomy slug
276 add_rewrite_rule( $slug.'/'.$taxonomy.'/(.+?)/?$', 'index.php?'.$taxonomy.'=$matches[1]', 'top' );
277 add_rewrite_rule( $slug.'/'.$taxonomy.'/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?'.$taxonomy.'=$matches[1]&feed=$matches[2]', 'top' );
278 add_rewrite_rule( $slug.'/'.$taxonomy.'/(.+?)/(feed|rdf|rss|rss2|atom)/?$', 'index.php?'.$taxonomy.'=$matches[1]&feed=$matches[2]', 'top' );
279 add_rewrite_rule( $slug.'/'.$taxonomy.'/(.+?)/page/?([0-9]{1,})/?$', 'index.php?'.$taxonomy.'=$matches[1]&paged=$matches[2]', 'top' );
280
281 if( $slug != $post_type ){
282 add_rewrite_rule( $post_type.'/'.$taxonomy.'/(.+?)/?$', 'index.php?'.$taxonomy.'=$matches[1]', 'top' );
283 add_rewrite_rule( $post_type.'/'.$taxonomy.'/(.+?)/feed/(feed|rdf|rss|rss2|atom)/?$', 'index.php?'.$taxonomy.'=$matches[1]&feed=$matches[2]', 'top' );
284 add_rewrite_rule( $post_type.'/'.$taxonomy.'/(.+?)/(feed|rdf|rss|rss2|atom)/?$', 'index.php?'.$taxonomy.'=$matches[1]&feed=$matches[2]', 'top' );
285 add_rewrite_rule( $post_type.'/'.$taxonomy.'/(.+?)/page/?([0-9]{1,})/?$', 'index.php?'.$taxonomy.'=$matches[1]&paged=$matches[2]', 'top' );
286 }
287
288 endforeach;
289
290 endforeach;
291 }
292
293 public function set_term_link( $termlink, $term, $taxonomy ) {
294 if( get_option('no_taxonomy_structure') )
295 return $termlink;
296
297 $taxonomy = get_taxonomy($taxonomy);
298 if( $taxonomy->_builtin )
299 return $termlink;
300
301 if( empty($taxonomy) )
302 return $termlink;
303
304 $wp_home = rtrim( get_option('home'), '/' );
305
306 $post_type = $taxonomy->object_type[0];
307 $slug = get_post_type_object($post_type)->rewrite['slug'];
308
309
310 //$termlink = str_replace( $term->slug.'/', $this->get_taxonomy_parents( $term->term_id,$taxonomy->name, false, '/', true ), $termlink );
311 $termlink = str_replace( $wp_home, $wp_home.'/'.$slug, $termlink );
312 $str = rtrim( preg_replace("/%[a-z_]*%/","",get_option("permalink_structure")) ,'/');
313 return str_replace($str, "", $termlink );
314
315 }
316 }
317
318 class Custom_Post_Type_Permalinks_Admin {
319
320 public function __construct () {
321 add_action('init', array(&$this,'load_textdomain'));
322 add_action('admin_init', array(&$this,'settings_api_init'),30);
323 }
324
325 public function load_textdomain() {
326 load_plugin_textdomain('cptp',false,'custom-post-type-permalinks');
327 }
328
329 public function settings_api_init() {
330 add_settings_section('cptp_setting_section',
331 __("Permalink Setting for custom post type",'cptp'),
332 array(&$this,'setting_section_callback_function'),
333 'permalink'
334 );
335
336 $post_types = get_post_types( array('_builtin'=>false, 'publicly_queryable'=>true, 'show_ui' => true) );
337 foreach ($post_types as $post_type):
338 if(isset($_POST['submit'])){
339 if( strpos($_POST['_wp_http_referer'],'options-permalink.php') !== FALSE ) {
340
341 $structure = trim(esc_attr($_POST[$post_type.'_structure']));#get setting
342
343 #default permalink structure
344 if( !$structure )
345 $structure = Custom_Post_Type_Permalinks::$default_structure;
346
347 $structure = str_replace('//','/','/'.$structure);# first "/"
348
349 #last "/"
350 $lastString = substr(trim(esc_attr($_POST['permalink_structure'])),-1);
351 $structure = rtrim($structure,'/');
352
353 if ( $lastString == '/')
354 $structure = $structure.'/';
355
356 update_option($post_type.'_structure', $structure );
357 }
358 }
359
360 add_settings_field($post_type.'_structure',
361 $post_type,
362 array(&$this,'setting_structure_callback_function'),
363 'permalink',
364 'cptp_setting_section',
365 $post_type.'_structure'
366 );
367
368 register_setting('permalink',$post_type.'_structure');
369 endforeach;
370
371 add_settings_field(
372 'no_taxonomy_structure',
373 __("Use custom permalink of custom taxonomy archive.",'cptp'),
374 array(&$this,'setting_no_tax_structure_callback_function'),
375 'permalink',
376 'cptp_setting_section'
377 );
378
379 register_setting('permalink','no_taxonomy_structure');
380
381 if(isset($_POST['submit']) && isset($_POST['_wp_http_referer']) && strpos($_POST['_wp_http_referer'],'options-permalink.php') !== FALSE ) {
382
383 if(!isset($_POST['no_taxonomy_structure'])){
384 $set = true;
385 }else {
386 $set = false;
387 }
388 update_option('no_taxonomy_structure', $set);
389 }
390 }
391
392 public function setting_section_callback_function() {
393 ?>
394 <p><?php _e("Setting permalinks of custom post type.",'cptp');?><br />
395 <?php _e("The tags you can use is WordPress Structure Tags and '%{custom_taxonomy_slug}%'.",'cptp');?><br />
396 <?php _e("%{custom_taxonomy_slug}% is replaced the taxonomy's term.'.",'cptp');?></p>
397
398 <p><?php _e("Presence of the trailing '/' is unified into a standard permalink structure setting.",'cptp');?><br />
399 <?php _e("If you don't entered permalink structure, permalink is configured /%year%/%monthnum%/%day%/%post_id%/.",'cptp');?>
400 </p>
401 <?php
402 }
403
404 public function setting_structure_callback_function( $option ) {
405 $post_type = str_replace('_structure',"" ,$option);
406 $slug = get_post_type_object($post_type)->rewrite['slug'];
407 if( !$slug )
408 $slug = $post_type;
409
410 echo '/'.$slug.' <input name="'.$option.'" id="'.$option.'" type="text" class="regular-text code" value="' . get_option($option) .'" />';
411 }
412
413 public function setting_no_tax_structure_callback_function(){
414 echo '<input name="no_taxonomy_structure" id="no_taxonomy_structure" type="checkbox" value="1" class="code" ' . checked( false, get_option('no_taxonomy_structure'),false) . ' /> ';
415 _e("If you check,The custom taxonomy's permalinks is example.com/post_type/taxonomy/term.","cptp");
416 }
417
418 }
419
420 new Custom_Post_Type_Permalinks;
421 new Custom_Post_Type_Permalinks_Admin;
422