Advertisement
arie_cristianD

add index.php in jnews custom enpoint

Oct 16th, 2024
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1.  
  2. function jnews_home_url_multilang( $path = '', $scheme = null ) {
  3.     if ( function_exists( 'pll_current_language' ) ) {
  4.         if ( isset( $path[0] ) && '/' !== $path[0] ) {
  5.             $path = '/' . $path;
  6.         }
  7.  
  8.         $polylang_setting = get_option( 'polylang', array() );
  9.         $default_lang     = $polylang_setting['default_lang'];
  10.         $current_lang     = pll_current_language();
  11.  
  12.         if ( isset( $polylang_setting['hide_default'] ) && $polylang_setting['hide_default'] ) {
  13.             if ( $default_lang === $current_lang ) {
  14.                 return home_url( '/index.php/' . $path, $scheme );
  15.             }
  16.         }
  17.  
  18.         return home_url( $current_lang . '/index.php/' . $path, $scheme );
  19.     }
  20.     return home_url( '/index.php/' . $path, $scheme );
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement