Skip to content

Commit

Permalink
fix for %parents% (I18N base), #67
Browse files Browse the repository at this point in the history
  • Loading branch information
cnb committed Dec 22, 2016
1 parent 7b70a3b commit 5e7547a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions news_manager/inc/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ function nm_get_date($format, $timestamp) {
function nm_get_url($query=false) {
global $PRETTYURLS, $NMPAGEURL, $NMPRETTYURLS;
$str = '';
$url = find_url($NMPAGEURL, nm_get_parent());
$parent = nm_get_parent();
$url = find_url($NMPAGEURL, $parent);
if (strpos($url, '%parents%/') !== false) // I18N plugin's placeholder for multilevel URLs
$url = str_replace('%parents%/', (empty($parent) ? '' : $parent.'/'), $url);
if ($query) {
switch($query) {
case 'post':
Expand Down Expand Up @@ -610,7 +613,7 @@ function nm_switch_template_file($tempfile) {
# since 3.1
# fix URLs with special permalink placeholders for the I18N plugin - backend only
function nm_patch_i18n_url($url) {
return str_replace(array('%language%/','%nondefaultlanguage%/','%parents%/'), array('','',''), $url);
return str_replace(array('%language%/','%nondefaultlanguage%/'), array('',''), $url);
}

## since 3.2
Expand Down

0 comments on commit 5e7547a

Please sign in to comment.