- Trạng thái
- Đã được giải quyết bởi nhà phát triển
- Đã giải quyết trong
- Unlimited Elements for Elementor 2.0.5
- Plugin/giao diện liên quan
- Unlimited Elements for Elementor
- Thẻ chủ đề
- Compatibility, Elementor Custom Widgets
Tổng quan về lỗi
Khi sử dụng Posts List Element từ Unlimited Elements for Elementor với WPML và Yoast SEO, mô-đun này không hiển thị Danh mục chính của Yoast trong các bản dịch. Thay vào đó, nó hiển thị danh mục đầu tiên (theo thứ tự bảng chữ cái) mà bài viết thuộc về.
Giải pháp tạm thời
Vui lòng đảm bảo bạn có bản sao lưu toàn bộ trang web trước khi tiếp tục.
- Mở tệp …/wp-content/plugins/unlimited-elements-for-elementor/provider/provider_params_processor.class.php.
- Tìm hàm
getPostMainCategoryở dòng 574. - Thay thế:
/** * 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); }
- Bằng:
/** * 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); }