Created
October 30, 2018 14:31
-
-
Save bigdigital/98d4925608650bdaf14302c0d9a1b7a4 to your computer and use it in GitHub Desktop.
The7 replace portfoilio slug with help of polylang
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'dt_of_get_option', 'dt_get_options_rewrite', 10, 2 ); | |
function dt_get_options_rewrite($saved_options, $name) { | |
if ($name !== 'general-post_type_portfolio_slug') return $saved_options; | |
if (!function_exists('pll_current_language')) return $saved_options; | |
$lang = pll_current_language('slug'); | |
switch ($lang){ | |
case "en": | |
$saved_options[$name] = 'englishslug'; | |
break; | |
case "fr": | |
$saved_options[$name] = 'frenchslug'; | |
break; | |
} | |
return $saved_options; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment