Viewing 2 replies - 1 through 2 (of 2 total)
  • [pt_br]
    Olá, Amigo.
    Para a lista suspensa eu uso o código padr?o do plugin:
    <?php pll_the_languages(array('display_names_as' =>'slug')); ?>

    leia mais aqui:
    https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/

    Para o select eu uso assim:

    <select name="languages" id="languages" required>
        <?php if(class_exists('Polylang'))  { 									
            global $polylang;
            if (isset($polylang)) {							
        ?>
        <optgroup label="<?php _e( 'Polylang', 'load_plugin_textdomain' ); ?>">
            <?php foreach ($polylang->get_languages_list() as $languages) { ?>
            <option value="<?php echo esc_attr($languages->locale); ?>" lang="<?php echo esc_attr($languages->flag_code); ?>">
                <?php echo esc_attr($languages->name); ?>
            </option>
            <?php } ?>
        </optgroup> 
        <?php } } ?>
    </select>
    Thread Starter vigneshdart

    (@vigneshdart)

    Hi,
    Thanks for your reply , but i dont know where i can use this code

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘display language and flag in dropdown menu’ is closed to new replies.