Custom Post Type Permalinks - Version 0.9.3.2

Version Description

  • wp_get_archives Bug Fix.
Download this release

Release Info

Developer Toro_Unit
Plugin Icon 128x128 Custom Post Type Permalinks
Version 0.9.3.2
Comparing to
See all releases

Code changes from version 0.9.3.1 to 0.9.3.2

Files changed (2) hide show
  1. custom-post-type-permalinks.php +14 -8
  2. readme.txt +4 -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.3.1
9
  Text Domain: cptp
10
  License: GPL2 or later
11
  Domain Path: /language/
@@ -423,8 +423,11 @@ class Custom_Post_Type_Permalinks {
423
  *
424
  */
425
  public function get_archives_link( $link ) {
 
 
 
426
  $c = isset($this->get_archives_where_r['taxonomy']) && is_array($this->get_archives_where_r['taxonomy']) ? $this->get_archives_where_r['taxonomy'] : ""; //[steve]
427
- $t = isset($this->get_archives_where_r['post_type']) ? $this->get_archives_where_r['post_type'] : "";
428
 
429
 
430
  $this->get_archives_where_r['post_type'] = isset($this->get_archives_where_r['post_type_slug']) ? $this->get_archives_where_r['post_type_slug'] : $t; // [steve] [*** bug fixing]
@@ -444,7 +447,12 @@ class Custom_Post_Type_Permalinks {
444
 
445
  $post_type = get_post_type_object( $this->get_archives_where_r['post_type'] );
446
  if(empty($c) ){ // [steve]
447
- $link_dir = $post_type->rewrite["slug"];
 
 
 
 
 
448
  }
449
  else{ // [steve]
450
  $c['name'] = ($c['name'] == 'category' && get_option('category_base')) ? get_option('category_base') : $c['name'];
@@ -562,13 +570,11 @@ class Custom_Post_Type_Permalinks {
562
  $slug = get_post_type_object($post_type)->rewrite['slug'];
563
  $with_front = get_post_type_object($post_type)->rewrite['with_front'];
564
 
565
-
566
  //$termlink = str_replace( $term->slug.'/', $this->get_taxonomy_parents( $term->term_id,$taxonomy->name, false, '/', true ), $termlink );
567
- $str = rtrim( preg_replace("/%[a-z_]*%/","",get_option("permalink_structure")) ,'/');//remove with front
568
  $termlink = str_replace($str."/", "/", $termlink );
569
- if(is_string($with_front) and $with_front !== "1" ) {
570
- $str = "/".$with_front;
571
- }elseif($with_front === false) {
572
  $str = "";
573
  }
574
  $slug = $str."/".$slug;
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.3.2
9
  Text Domain: cptp
10
  License: GPL2 or later
11
  Domain Path: /language/
423
  *
424
  */
425
  public function get_archives_link( $link ) {
426
+ if(!isset($this->get_archives_where_r['post_type'])) {
427
+ return $link;
428
+ }
429
  $c = isset($this->get_archives_where_r['taxonomy']) && is_array($this->get_archives_where_r['taxonomy']) ? $this->get_archives_where_r['taxonomy'] : ""; //[steve]
430
+ $t = $this->get_archives_where_r['post_type'];
431
 
432
 
433
  $this->get_archives_where_r['post_type'] = isset($this->get_archives_where_r['post_type_slug']) ? $this->get_archives_where_r['post_type_slug'] : $t; // [steve] [*** bug fixing]
447
 
448
  $post_type = get_post_type_object( $this->get_archives_where_r['post_type'] );
449
  if(empty($c) ){ // [steve]
450
+ if(isset( $post_type->rewrite["slug"] )) {
451
+ $link_dir = $post_type->rewrite["slug"];
452
+ }
453
+ else{
454
+ $link_dir = $this->get_archives_where_r['post_type'];
455
+ }
456
  }
457
  else{ // [steve]
458
  $c['name'] = ($c['name'] == 'category' && get_option('category_base')) ? get_option('category_base') : $c['name'];
570
  $slug = get_post_type_object($post_type)->rewrite['slug'];
571
  $with_front = get_post_type_object($post_type)->rewrite['with_front'];
572
 
 
573
  //$termlink = str_replace( $term->slug.'/', $this->get_taxonomy_parents( $term->term_id,$taxonomy->name, false, '/', true ), $termlink );
574
+ $str = rtrim( preg_replace( "/%[a-z_]*%/", "" ,get_option("permalink_structure")) ,'/' );//remove with front
575
  $termlink = str_replace($str."/", "/", $termlink );
576
+
577
+ if( $with_front === false ) {
 
578
  $str = "";
579
  }
580
  $slug = $str."/".$slug;
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.3.1
7
 
8
  Lets you edit the permalink of custom post type.
9
 
@@ -39,6 +39,9 @@ That's it. You can access the permalinks setting by going to *Settings -> Permal
39
 
40
  == Changelog ==
41
 
 
 
 
42
  = 0.9.3.1 =
43
  * Tested 3.6
44
  *Bug Fix.
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.3.2
7
 
8
  Lets you edit the permalink of custom post type.
9
 
39
 
40
  == Changelog ==
41
 
42
+ = 0.9.3.2 =
43
+ * wp_get_archives Bug Fix.
44
+
45
  = 0.9.3.1 =
46
  * Tested 3.6
47
  *Bug Fix.