Last active
August 29, 2018 12:04
-
-
Save srdjan-jcc/00ee8d15afb3c6c1497af5ff92d32a8e to your computer and use it in GitHub Desktop.
GeneratePress and WPML
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 | |
/* | |
Plugin Name: GeneratePress and WPML | |
Version: 0.1 | |
Description: Applies fixes. | |
*/ | |
add_filter( 'generate_hook_element_display', 'wpml_generate_hook_element_display_filter', 10, 2 ); | |
function wpml_generate_hook_element_display_filter( $display, $post_id ) { | |
$current_language = apply_filters( 'wpml_current_language', null ); | |
$element_language = apply_filters( 'wpml_element_language_code', null, array( | |
'element_id' => $post_id, | |
'element_type' => 'post_gp_elements' | |
) | |
); | |
if ( $current_language != $element_language ) { | |
$display = false; | |
} | |
return $display; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment