Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Fix Header/Footer Template Not Support for Polylang
- */
- if ( function_exists( 'pll_current_language' ) && ! function_exists( 'jkit_custom_template_conditions' ) ) {
- /**
- * Custom Condition for Jeg Elementor Kit Header/Footer Template
- *
- * @param bool $flag The Conditions.
- * @param int $post_id The Post ID.
- * @param int $header_id The Template ID.
- * @param array $conditions The Condition args.
- */
- function jkit_custom_template_conditions( $flag, $post_id, $header_id, $conditions ) {
- /**
- * Get The Current Language by `pll_current_language()` functions
- */
- $current_lang = pll_current_language();
- /**
- * List Template ID for each Languages
- *
- * Wrap by array, if have multivalue (many template), write like this:
- *
- * array( 4407, 4408 ); // array( id1, id2, id3 );
- */
- $indonesia_template_ids = array( 4407 ); /** Indonesia Template IDs */
- $english_template_id = array( 4405 ); /** English Template IDs */
- /**
- * Check if Template ID in Language Templates
- */
- if ( in_array( $header_id, $indonesia_template_ids ) ) {
- /**
- * Check if current language is Indonesia (id)
- */
- if ( $current_lang === 'id' ) {
- $flag = $flag && true;
- } else {
- $flag = $flag && false;
- }
- }
- /**
- * Check if Template ID in Language Templates
- */
- if ( in_array( $header_id, $english_template_id ) ) {
- /**
- * Check if current language is English (en)
- */
- if ( $current_lang === 'en' ) {
- $flag = $flag && true;
- } else {
- $flag = $flag && false;
- }
- }
- return $flag;
- }
- add_filter( 'jkit_check_template_conditions', 'jkit_custom_template_conditions', 10, 4 );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement