WPML

問題の概要

現在、ElementorのSocial Iconsウィジェットを使用している場合、そのリンクや属性を翻訳することはできません。

回避策

この問題はWPML Multilingual CMS 4.8で修正されました。 更新するとサイト上の問題は解決するため、この回避策が必要になるのは、まだ更新できない場合のみです。

先に進む前に、サイトの完全なバックアップを必ず作成してください。

  • テーマの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ページを更新し、再度翻訳します。

すべての既知の問題

まだこの問題が発生しますか?

アップデートしても問題が解決しない場合は、サポートのご質問をお寄せください。一緒に調査いたします。