WPML
상태
해결됨
보고된 제품
WPML Multilingual CMS 4.6.5
해결된 버전
WPML Multilingual CMS 4.8
관련 플러그인/테마
Elementor
주제 태그
Compatibility

문제 개요

현재 Elementor의 Social Icons 위젯을 사용할 때 해당 링크와 속성을 번역할 수 없습니다.

임시 해결 방법

진행하기 전에 반드시 사이트의 전체 백업을 완료하세요.


  • 테마의 functions.php 파일에 아래의 PHP 코드를 추가하세요:
    add_action('init', function () {
    	add_filter('wpml_elementor_widgets_to_translate', function ($widgets) {
    		$widgets['social-icons'] = [
    			'conditions' => ['widgetType' => 'social-icons'],
    			'fields'     => [],
    			'integration-class' => 'elementorSocialIcons'
    		];
    		return $widgets;
    	});
    
    	/**
    	 * Class to translate the Elementor social-icons widget. 
    	 * 
    	 * @see wpmltriage-481
    	 */
    	class elementorSocialIcons extends WPML_Elementor_Module_With_Items {
    
    		/**
    		 * @return string
    		 */
    		public function get_items_field() {
    			return 'social_icon_list';
    		}
    
    		/**
    		 * @return array
    		 */
    		public function get_fields() {
    			return [
    				'link' => [
    					'url',
    					'custom_attributes'
    				]
    			];
    		}
    
    		/**
    		 * @param string $field
    		 *
    		 * @return string
    		 */
    		protected function get_title($field) {
    			switch ($field) {
    				case 'url':
    					return esc_html__('Social Icon: URL', 'elementor');
    				case 'custom_attributes':
    					return esc_html__('Social Icon: Custom Attributes', 'elementor');
    				default:
    					return '';
    			}
    		}
    
    		/**
    		 * @param string $field
    		 *
    		 * @return string
    		 */
    		protected function get_editor_type($field) {
    			switch ($field) {
    				case 'custom_attributes':
    					return 'LINE';
    				case 'url':
    					return 'LINK';
    				default:
    					return '';
    			}
    		}
    	}
    });

  • Elementor 페이지를 업데이트하고 다시 번역하세요.

알려진 모든 문제 →