WPML
ステータス
開発者により解決済み
関連するプラグイン/テーマ
Houzez
トピックタグ
Compatibility

問題の概要

Houzezテーマを使用している場合、「メディア」セクションから追加された物件のメディア画像には、翻訳された物件ページで翻訳済みのALTテキストが表示されません。

回避策

続行する前に、必ずサイトの完全なバックアップを作成してください。


  • テーマのfunctions.phpファイルを開きます。

  • 次のスニペットを追加します。
    add_filter('get_post_metadata', 'wpml_compsupp7300_filter_fave_property_images', 10, 4);
    
    function wpml_compsupp7300_filter_fave_property_images($null, $object_id, $meta_key, $single) {
        
    	// Target the specific meta key
        if ($meta_key !== 'fave_property_images') {
            return $null;
        }
    
        // Prevent recursion by temporarily removing the filter
        remove_filter('get_post_metadata', 'wpml_compsupp7300_filter_fave_property_images', 10);
    
        // Fetch the original meta value
        $images = get_post_meta($object_id, $meta_key, $single);
    
        // Re-add the filter
        add_filter('get_post_metadata', 'wpml_compsupp7300_filter_fave_property_images', 10, 4);
    
        // Check if we actually got an array
        if (is_array($images)) {
            foreach ($images as &$image_id) {
                // Apply the WPML filter to each item (image ID)
                $image_id = apply_filters('wpml_object_id', $image_id, 'attachment', true);
            }
        }
    
        return $images;
    }

すべての既知の問題 →