Skip to content

Commit

Permalink
use search_url or geter method based on polylang version (#6081)
Browse files Browse the repository at this point in the history
Co-authored-by: Vasilis Manthos <vmanthos@gmail.com>
  • Loading branch information
mostafa-hisham and vmanthos committed Aug 9, 2023
1 parent 63bbeb3 commit cb7dd13
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion inc/functions/i18n.php
Expand Up @@ -271,7 +271,14 @@ function get_rocket_i18n_uri() { // phpcs:ignore WordPress.NamingConventions.Pre
$pll = function_exists( 'PLL' ) ? PLL() : $GLOBALS['polylang'];

if ( ! empty( $pll ) && is_object( $pll ) ) {
$urls = wp_list_pluck( $pll->model->get_languages_list(), 'search_url' );
if ( ! defined( 'POLYLANG_VERSION' ) || version_compare( POLYLANG_VERSION, '3.4', '<' ) ) {
$urls = wp_list_pluck( $pll->model->get_languages_list(), 'search_url' );
}else {
$languages = $pll->model->get_languages_list();
foreach ( $languages as $language ) {
$urls[] = $language->get_home_url();
}
}
}
}

Expand Down

0 comments on commit cb7dd13

Please sign in to comment.