- Status
- Resolvido pelo autor
- Resolvido em
- Unlimited Elements for Elementor 2.0.5
- Plugin/tema relacionado
- Unlimited Elements for Elementor
- Tags de tópico
- Compatibility, Elementor Custom Widgets
Visão geral do problema
Ao usar o Posts List Element do Unlimited Elements for Elementor com o WPML e o Yoast SEO, o módulo não exibe a categoria principal do Yoast nas traduções. Em vez disso, ele mostra a primeira categoria (em ordem alfabética) à qual o post pertence.
Solução alternativa
Por favor, certifique-se de ter um backup completo do site antes de prosseguir.
- Abra o arquivo …/wp-content/plugins/unlimited-elements-for-elementor/provider/provider_params_processor.class.php.
- Procure a função
getPostMainCategoryna linha 574. - Substitua:
/** * 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); }
- Por:
/** * 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); }