Version Description
Download this release
Release Info
Developer | Toro_Unit |
Plugin | Custom Post Type Permalinks |
Version | 0.9.2.1 |
Comparing to | |
See all releases |
Code changes from version 0.9.1 to 0.9.2.1
- custom-post-type-permalinks.php +13 -6
- readme.txt +2 -1
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: 0.9.1
|
9 |
Text Domain: cptp
|
10 |
License: GPL2 or later
|
11 |
Domain Path: /
|
@@ -41,6 +41,7 @@ class Custom_Post_Type_Permalinks {
|
|
41 |
|
42 |
|
43 |
|
|
|
44 |
public $version = "0.9";
|
45 |
|
46 |
public $default_structure = '/%postname%/';
|
@@ -352,8 +353,9 @@ class Custom_Post_Type_Permalinks {
|
|
352 |
$permalink = str_replace( "%second%", date("s",$post_date), $permalink );
|
353 |
|
354 |
|
355 |
-
$permalink = home_url().user_trailingslashit( $permalink );
|
356 |
-
|
|
|
357 |
return $permalink;
|
358 |
}
|
359 |
|
@@ -619,7 +621,7 @@ class Custom_Post_Type_Permalinks {
|
|
619 |
|
620 |
$post_types = get_post_types( array('_builtin'=>false, 'publicly_queryable'=>true, 'show_ui' => true) );
|
621 |
foreach ($post_types as $post_type):
|
622 |
-
if(isset($_POST['submit'])){
|
623 |
if( strpos($_POST['_wp_http_referer'],'options-permalink.php') !== FALSE ) {
|
624 |
|
625 |
$structure = trim(esc_attr($_POST[$post_type.'_structure']));#get setting
|
@@ -688,13 +690,18 @@ class Custom_Post_Type_Permalinks {
|
|
688 |
public function setting_structure_callback_function( $option ) {
|
689 |
$post_type = str_replace('_structure',"" ,$option);
|
690 |
$slug = get_post_type_object($post_type)->rewrite['slug'];
|
691 |
-
|
692 |
-
$slug = $post_type;
|
693 |
|
694 |
$value = get_option($option);
|
695 |
if( !$value )
|
696 |
$value = $this->default_structure;
|
697 |
|
|
|
|
|
|
|
|
|
|
|
|
|
698 |
echo '<code>'.home_url().'/'.$slug.'</code> <input name="'.$option.'" id="'.$option.'" type="text" class="regular-text code" value="' . $value .'" />';
|
699 |
}
|
700 |
|
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.9.2.1
|
9 |
Text Domain: cptp
|
10 |
License: GPL2 or later
|
11 |
Domain Path: /
|
41 |
|
42 |
|
43 |
|
44 |
+
|
45 |
public $version = "0.9";
|
46 |
|
47 |
public $default_structure = '/%postname%/';
|
353 |
$permalink = str_replace( "%second%", date("s",$post_date), $permalink );
|
354 |
|
355 |
|
356 |
+
$permalink = home_url()."/".user_trailingslashit( $permalink );
|
357 |
+
$permalink = str_replace("//", "/", $permalink);
|
358 |
+
$permalink = str_replace(":/", "://", $permalink);
|
359 |
return $permalink;
|
360 |
}
|
361 |
|
621 |
|
622 |
$post_types = get_post_types( array('_builtin'=>false, 'publicly_queryable'=>true, 'show_ui' => true) );
|
623 |
foreach ($post_types as $post_type):
|
624 |
+
if(isset($_POST['submit']) and isset($_POST['_wp_http_referer'])){
|
625 |
if( strpos($_POST['_wp_http_referer'],'options-permalink.php') !== FALSE ) {
|
626 |
|
627 |
$structure = trim(esc_attr($_POST[$post_type.'_structure']));#get setting
|
690 |
public function setting_structure_callback_function( $option ) {
|
691 |
$post_type = str_replace('_structure',"" ,$option);
|
692 |
$slug = get_post_type_object($post_type)->rewrite['slug'];
|
693 |
+
$with_front = get_post_type_object($post_type)->rewrite['with_front'];
|
|
|
694 |
|
695 |
$value = get_option($option);
|
696 |
if( !$value )
|
697 |
$value = $this->default_structure;
|
698 |
|
699 |
+
global $wp_rewrite;
|
700 |
+
$front = substr( $wp_rewrite->front, 1 );
|
701 |
+
if( $front and $with_front ) {
|
702 |
+
$slug = $front.$slug;
|
703 |
+
}
|
704 |
+
|
705 |
echo '<code>'.home_url().'/'.$slug.'</code> <input name="'.$option.'" id="'.$option.'" type="text" class="regular-text code" value="' . $value .'" />';
|
706 |
}
|
707 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: Toro_Unit
|
|
3 |
Tags: permalink,permalinks,custom post type,custom taxonomy,cms
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 3.6
|
6 |
-
Stable tag: 0.9.1
|
7 |
|
8 |
Lets you edit the permalink of custom post type.
|
9 |
|
@@ -14,6 +14,7 @@ Change custom taxonomy archive's permalink to "example.org/post_type/taxonomy_na
|
|
14 |
|
15 |
Nightly Build https://github.com/Toro-Unit/custom-post-type-permalinks
|
16 |
|
|
|
17 |
|
18 |
|
19 |
|
3 |
Tags: permalink,permalinks,custom post type,custom taxonomy,cms
|
4 |
Requires at least: 3.4
|
5 |
Tested up to: 3.6
|
6 |
+
Stable tag: 0.9.2.1
|
7 |
|
8 |
Lets you edit the permalink of custom post type.
|
9 |
|
14 |
|
15 |
Nightly Build https://github.com/Toro-Unit/custom-post-type-permalinks
|
16 |
|
17 |
+
Donation: Please send Amazon Gift to donate[at]torounit.com.
|
18 |
|
19 |
|
20 |
|