WordPress.org

Ready to get started?Download WordPress

Forums

add id “selected” based on URL to wordpress language switcher (1 post)

  1. alrobelller
    Member
    Posted 2 years ago #

    <?php if( is_front_page() || is_home() ) { ?>
    <div class="motto_info_wrapper">
        <div class="motto">
        <h6>режиссёр-постановщик</h6>
        <h1>Kirill Zolotarev</h1>
        <ul>
            <li id="<?php if ( $_SERVER['REQUEST_URI'] == '/' ) { echo "selected"; }?>"><a class="russian_lang" href="<?php bloginfo('url'); ?>" title="">RUSSIAN</a></li>
            <li> | </li>
            <li id="<?php if ( $_SERVER['REQUEST_URI'] == '/en' ) { echo "selected"; }?>"><a class="english_lang" href="<?php bloginfo('url'); ?>/en/" title="">ENGLISH</a></li>
        </ul>
        <div id="blob"></div>
        </div>
    </div>
    <?php } ?>

    Though it doesn't work here mysite

Topic Closed

This topic has been closed to new replies.

About this Topic