- Stato
- Risolto dall’autore
- Plugin/tema correlato
- Houzez
- Tag dell’argomento
- Compatibility
Panoramica del problema
Quando usi il tema Houzez, le immagini dei media delle proprietà aggiunte tramite la sezione Media non mostrano il testo ALT tradotto nelle pagine tradotte delle proprietà.
Soluzione alternativa
Assicurati di avere un backup completo del tuo sito prima di procedere.
- Apri il file functions.php del tuo tema.
- Aggiungi il seguente snippet:
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; }