| @@ -767,10 +767,10 @@ | ||
| 767 | 767 | * Adds the display filters to be used in the meta_query while displaying the charts. |
| 768 | 768 | */ |
| 769 | 769 | private function getDisplayFilters( &$query_args ) { |
| 770 | 770 | $query = array(); |
| 771 | - | |
| 772 | - if ( Visualizer_Module::is_pro() && function_exists( 'icl_get_languages' ) ) { | |
| 771 | + global $sitepress; | |
| 772 | + if ( Visualizer_Module::is_pro() && ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) ) { | |
| 773 | 773 | $current_lang = icl_get_current_language(); |
| 774 | 774 | if ( in_array( $current_lang, array( 'all', icl_get_default_language() ), true ) ) { |
| 775 | 775 | $query[] = array( |
| 776 | 776 | 'key' => 'chart_lang', |
| @@ -1137,18 +1137,17 @@ | ||
| 1137 | 1137 | * @param int $chart_id Chart ID. |
| 1138 | 1138 | * @return bool Default false |
| 1139 | 1139 | */ |
| 1140 | 1140 | public function addMultilingualSupport( $chart_id ) { |
| 1141 | + global $sitepress; | |
| 1141 | 1142 | if ( Visualizer_Module::is_pro() ) { |
| 1142 | 1143 | return; |
| 1143 | 1144 | } |
| 1144 | - if ( function_exists( 'icl_get_languages' ) ) { | |
| 1145 | + if ( function_exists( 'icl_get_languages' ) && $sitepress instanceof \SitePress ) { | |
| 1145 | 1146 | $language = icl_get_languages(); |
| 1146 | 1147 | $current_lang = icl_get_current_language(); |
| 1147 | 1148 | $default_lang = icl_get_default_language(); |
| 1148 | 1149 | $post_info = wpml_get_language_information( null, $chart_id ); |
| 1149 | - | |
| 1150 | - global $sitepress; | |
| 1151 | 1150 | $translations = array(); |
| 1152 | 1151 | if ( ! empty( $post_info ) && ( $default_lang === $post_info['language_code'] ) ) { |
| 1153 | 1152 | $trid = $sitepress->get_element_trid( $chart_id, 'post_' . Visualizer_Plugin::CPT_VISUALIZER ); |
| 1154 | 1153 | $translations = $sitepress->get_element_translations( $trid ); |