- Stato
- Risolto dall’autore
- Risolto in
- Unlimited Elements for Elementor 2.0.5
- Plugin/tema correlato
- Unlimited Elements for Elementor
- Tag dell’argomento
- Compatibility, Elementor Custom Widgets
Panoramica del problema
Quando utilizzi il Posts List Element di Unlimited Elements for Elementor con WPML e Yoast SEO, il modulo non mostra la categoria principale di Yoast nelle traduzioni. Mostra invece la prima categoria (in ordine alfabetico) a cui appartiene l’articolo.
Soluzione alternativa
Assicurati di avere un backup completo del tuo sito prima di procedere.
- Apri il file …/wp-content/plugins/unlimited-elements-for-elementor/provider/provider_params_processor.class.php.
- Cerca la funzione
getPostMainCategoryalla riga 574. - Sostituisci:
/** * get post main category from the list of terms */ private function getPostMainCategory($arrTerms, $postID){ //get term data if(count($arrTerms) == 1){ //single $arrTermData = UniteFunctionsUC::getArrFirstValue($arrTerms); return($arrTermData); } $arrMeta = UniteFunctionsWPUC::getPostMeta($postID,true); $mainCategoryID = UniteFunctionsUC::getVal($arrMeta, "_yoast_wpseo_primary_category"); if(empty($mainCategoryID)) $mainCategoryID = UniteFunctionsUC::getVal($arrMeta, "rank_math_primary_category"); if(empty($mainCategoryID)){ unset($arrTerms["uncategorized"]); $arrTermData = UniteFunctionsUC::getArrFirstValue($arrTerms); return($arrTermData); }
- Con:
/** * get post main category from the list of terms */ private function getPostMainCategory($arrTerms, $postID){ //get term data if(count($arrTerms) == 1){ //single $arrTermData = UniteFunctionsUC::getArrFirstValue($arrTerms); return($arrTermData); } $arrMeta = UniteFunctionsWPUC::getPostMeta($postID,true); $mainCategoryID = UniteFunctionsUC::getVal($arrMeta, "_yoast_wpseo_primary_category"); if(empty($mainCategoryID)) $mainCategoryID = UniteFunctionsUC::getVal($arrMeta, "rank_math_primary_category"); // WPML Workaround for compsupp-8023 if (!empty($mainCategoryID)) { $mainCategoryID = apply_filters('wpml_object_id', $mainCategoryID, 'category', true); } if(empty($mainCategoryID)){ unset($arrTerms["uncategorized"]); $arrTermData = UniteFunctionsUC::getArrFirstValue($arrTerms); return($arrTermData); }