WordPress.org

Ready to get started?Download WordPress

Forums

qTranslate
Different menu's on each language (3 posts)

  1. eXtreaL
    Member
    Posted 1 year ago #

    Hi,

    I'm using Qtranslate on my website with 3 different languages. Everything is working just fine, except for my menu.

    WordPress is generating the menu using <?php get_template_part( 'primary', 'menu' ); ?>. Now I'd like to remove certain menu items when the user has the language set to English. I'm trying to achieve this by leaving the title and content of the page empty, this will display the menu item as "(Dutch) [page name]". I need the page to be completely removed from the menu.

    Thanks in advance!
    Lorenzo

    http://wordpress.org/extend/plugins/qtranslate/

  2. Kangarooo
    Member
    Posted 1 year ago #

    Yes me too.
    In Language settings for qtranslate theres checkmark for Hide Untranslated Content and it doesnt doesnt work.
    I made In 1Lang Title and left others empty but still pages and posts show up in other languages.

  3. C S
    Member
    Posted 1 year ago #

    Do you know PHP?

    First, I would add a class to my <body> naming the selected language, e.g.
    <body class="en"> or
    <body class="de">

    Then you can use CSS to remove selected menu items. Just like this:

    .en li#menu-item-215 { display: none; }
    .de li#menu-item-216 { display: none; }

    How to add a class lang?
    No problem, if you use the parameter option of qTranslate.

    <?php
    $language = $_GET['lang'];
    ?>
    <body class="<?php echo $language; ?>">

    Use Firebug to find out the IDs of your menu items.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic