Advanced-Post-List / advanced-post-list

A WordPress plugin to create custom post lists
15 stars 7 forks source link

WPML Compatibility #96

Closed EkoJR closed 6 years ago

EkoJR commented 6 years ago

NOTE TO WPML Devs: Majority of the issues may have been solved. Need to test and will upload changes. I'll update this note every 12-24 hours (10/23/17 3:00pm UTC)

In (Alpha) 0.4, the Preset Post List conversion to Post Data added some incompatibility issues with WPML. This is both considered a Blocker Defect and a Support Feature.

Additional Notes

Dev Notes

Todo List

EkoJR commented 6 years ago

APL Design Class

There are multiple flaws being produced with an alternate concept with Custom Post Types (CPTs). Loosely named: Child Post Type, Twin Post Types, etc.

This concept has to remain for future implementation, but at the same time can be modified in the same area and to keep separate.

Ideas and Solutions

EkoJR commented 6 years ago

SQL Request that is Producing error

Problems begin with a WP Hook posts_where inside WP_Query::get_posts() if suppression is set to true.

Function: WPML_Query_Filter::posts_where_filter() File Path: sitepress-multilingual-cms\inc\query-filtering\wpml-query-filter.class.php

SELECT wp_posts.* 
FROM   wp_posts 
        JOIN wp_icl_translations t 
        ON wp_posts.id = t.element_id 
            AND t.element_type = Concat('post_', wp_posts.post_type) 
WHERE  1 = 1 
        AND wp_posts.post_name = 'wpml-04' 
        AND wp_posts.post_type = 'apl_design' 
        AND ( ( wp_posts.post_status = 'publish' 
                OR wp_posts.post_status = 'future' 
                OR wp_posts.post_status = 'draft' 
                OR wp_posts.post_status = 'pending' 
                OR wp_posts.post_status = 'trash' 
                OR wp_posts.post_status = 'private'
            )
        ) 
        AND ( ( t.language_code = 'en' 
                AND wp_posts.post_type IN ( 'post', 'page', 'attachment', 'apl_design' ) 
            ) 
            OR wp_posts.post_type NOT IN ( 'post', 'page', 'attachment', 'apl_design' )
        ) 
ORDER  BY wp_posts.post_date DESC 
EkoJR commented 6 years ago

With the APL_Design, majority of the issues were fixed using a SitePress::set_element_language_details( $post_id, 'post_apl_design', null, ICL_LANGUAGE_CODE );