- Status
- Vom Autor gelöst
- Gelöst in
- Unlimited Elements for Elementor 2.0.5
- Zugehöriges Plugin/Theme
- Unlimited Elements for Elementor
- Themen-Tags
- Compatibility, Elementor Custom Widgets
Übersicht über das Problem
Bei der Verwendung des Posts List Element von Unlimited Elements for Elementor mit WPML und Yoast SEO zeigt das Modul die primäre Yoast-Kategorie in Übersetzungen nicht an. Stattdessen zeigt es die erste Kategorie (in alphabetischer Reihenfolge) an, zu der der Beitrag gehört.
Problemumgehung
Bitte erstellen Sie ein vollständiges Backup Ihrer Website, bevor Sie fortfahren.
- Öffnen Sie die Datei …/wp-content/plugins/unlimited-elements-for-elementor/provider/provider_params_processor.class.php.
- Suchen Sie nach der Funktion
getPostMainCategoryin Zeile 574. - Ersetzen Sie:
/** * 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); }
- Durch:
/** * 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); }