Tag Archives: add_theme_support

xili-language v. 2.15.1: flag features improved for theme’s developer

xili-language v. 2.15.0 introduced function add_theme_support ( 'custom_xili_flag') to permit flag features inside Media Library.
By adding a parameter array ($args), xili-language v. 2.15.1 introduces a way to register default flags coming from a sub-folder of the theme’s folder. An easy way to provide adapted flags to the webmaster in conformity with the design and look of the theme. No need to upload these preset images.

Example of code to put inside a function call by an add_action ‘after_setup_theme‘ (priority set to 12)

$listlanguages = array(
'ar_ar','ar_ma', 'ar_xx', 'cn_cn',
'de_de', 'en_us', 'es_es', 'fr_be', 'fr_ca', 'fr_fr',
'it_it', 'ja_ja', 'ja', 'km_kh', 'pt_pt', 'ru_ru', 'zh_cn') ;

$args = array();
foreach ( $listlanguages as $one_language ) {
$args[$one_language] = array(
'path' => '%2$s/images/flags/'.$one_language.'.png',
'height' => 16,
'width' => 11
add_theme_support ( 'custom_xili_flag', $args );

%2$s is used in ‘path’ because the flags are inside the child theme in this example. Here, it is supposed that all the pictures are present.

To deliver examples of loop, twenty fourteen-xili theme is managed inside xili-language plugin itself using available language list and testing if picture exists. And latest version of twenty thirteen-xili, will include another way.