Last active
October 11, 2018 16:30
-
-
Save EdenK/61297b6c42279c487a8ba9ce5c64430f to your computer and use it in GitHub Desktop.
Wordpress: WPML & Elementor fix for elementor library translations (Header etc..).
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Wordpress: WPML & Elementor fix for elementor library translations (Header etc..). | |
*/ | |
function wpml_elementor_library( $theme_template_id ) { | |
return apply_filters( 'wpml_object_id', $theme_template_id, 'elementor_library', true ); | |
} | |
add_filter('elementor/theme/get_location_templates/template_id', 'wpml_elementor_library', 10, 1); | |
/** | |
* Fix elementor library cahce that saved only the current langauge and overwrite all the others. | |
*/ | |
function elementor_library_set_suppress_filters( $query ) { | |
if( $query->query_vars['post_type'] === 'elementor_library' | |
&& $query->query_vars['meta_key'] === '_elementor_conditions' ) { | |
$query->set( 'suppress_filters', true ); | |
} | |
} | |
add_action( 'pre_get_posts', 'elementor_library_set_suppress_filters' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment