Skip to content

Commit

Permalink
CPT + neighborhood urls shows 404 page not found - FIXED
Browse files Browse the repository at this point in the history
  • Loading branch information
kprajapatii committed Apr 16, 2019
1 parent 19cd9a9 commit 9e55277
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions change_log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Post images now uses image cover by default and gives option to change to x,y or none - CHANGED/ADDED
* Post images limit_show param added, this can be used to hide some images in gallery output but still load them via lightbox - ADDED
* Permalink issue with %post_id% rewrite tag - FIXED
* CPT + neighborhood urls shows 404 page not found - FIXED

= 2.0.0.55 =
* "Elvyre - Retina Ready Wordpress Theme" layout compatibility for detail & archive pages - ADDED
Expand Down
11 changes: 7 additions & 4 deletions includes/class-geodir-permalinks.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,17 @@ public function add_rewrite_rule($regex, $redirect, $after = ''){
}
}
}

$count = ( 10 * count( explode( "/", str_replace( array( '([^/]+)','([^/]*)' ), '', $regex ) ) ) ) -
( substr_count( $regex, '([^/]+)' ) + substr_count( $regex,'([^/]*)' ) ) +
( $static_sections * 11 ) +
( substr( $regex, -3 ) == '/?$' ? 1 : 0 ); // High priority to "^places/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?$" than "^places/([^/]*)/([^/]*)/([^/]*)/([^/]*)/?" to fix cpt + neighbourhood urls

$this->rewrite_rules[$regex] = array(
'regex' => $regex,
'redirect' => $redirect,
'after' => $after,
'count' =>
(10 * count( explode("/", str_replace(array('([^/]+)','([^/]*)'),'',$regex)) ) )
- (substr_count($regex,'([^/]+)') + substr_count($regex,'([^/]*)'))
+ ($static_sections * 11)
'count' => $count
//'count' => (10 * count( explode("/", str_replace(array('([^/]+)','([^/]*)'),'',$regex)) ) ) - (substr_count($regex,'([^/]+)') + substr_count($regex,'([^/]*)'))//count( explode("/", str_replace(array('([^/]+)','([^/]*)'),'',$regex)) ),
//'count' => count( explode("/", str_replace(array('([^/]+)','([^/]*)'),'',$regex)) ),
//'countx' => explode("/", str_replace(array('([^/]+)','([^/]*)'),'',$regex))
Expand Down

0 comments on commit 9e55277

Please sign in to comment.