Skip to content

Instantly share code, notes, and snippets.

@allysonsouza
Created April 26, 2018 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save allysonsouza/e9191679d601449d8b7231d40a06175f to your computer and use it in GitHub Desktop.
Save allysonsouza/e9191679d601449d8b7231d40a06175f to your computer and use it in GitHub Desktop.
Creating fields for each language in customizer with Kirki and WPML
<?php
if( function_exists( 'icl_get_languages' ) ) {
$languages = icl_get_languages( 'skip_missing=N&orderby=KEY&order=DIR&link_empty_to=str');
}
if( !empty( $languages ) ) {
foreach( array_reverse( $languages ) as $lang ) {
Kirki::add_field( 'daibase', array(
'settings' => 'field_' . $lang['code'],
'label' => esc_attr__( 'Selo', 'textdomain' ),
'section' => 'home_' . $lang['code'],
'type' => 'image',
'priority' => 10,
) );
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment