Skip to content

Instantly share code, notes, and snippets.

@bigdigital
Created October 30, 2018 14:31
Show Gist options
  • Save bigdigital/98d4925608650bdaf14302c0d9a1b7a4 to your computer and use it in GitHub Desktop.
Save bigdigital/98d4925608650bdaf14302c0d9a1b7a4 to your computer and use it in GitHub Desktop.
The7 replace portfoilio slug with help of polylang
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