qtranslate custom menu

Software - Discutii / Probleme
(Atentie - fara linkuri catre diverse softuri Crack/Warez! - Primiti BAN instant!)

Moderator: DeeJay

qtranslate custom menu

Post #1 » by DeeJay » 01 Apr 2017 23:28

for anyone having problem with qtranslate and wordpress menu with custom links reverting to the default language you can solve the problem like this:

in used theme's file functions.php add below code before
Code: Select all
?>
Code: Select all
function vmf_menu_links($items, $args) {
     $arraymeniuri=array(64,65,66,67); //menu ids with language problem
    if(qtrans_getlanguage() == 'en)
    {
          return $items; //if is default en language then return as is
     }
     
    foreach ($items as $item) {
          if (in_array($item->ID,$arraymeniuri))
              {
              $item->url = $item->url.'&lang=ro'; //add lang parameter to url
                }
     }
     return $items;
}
add_filter('wp_nav_menu_objects', 'vmf_menu_links', 10, 2);
I spin this!
My PC: I7 3770, 16G Ram, GTX 980, SSD 180GB

User avatar




GameForest

The best online Gaming Community!
GameForest is the perfect place for all gamers!
Join our Counter-Strike Source, Counter-Strike Global Offensive and Team Fortress 2 dedicated servers and have a great fun time!

Forum started on 16 Mar 2011 19:37 and in existence for 13 Years, 1 Month and 31 Days
GameForest, WebForest are registered trademarks of IDeSys NetWorks S.R.L., Valve, the Valve logo, Half-Life, the Half-Life logo, the Lambda logo, Steam, the Steam logo, Team Fortress, the Team Fortress logo, Opposing Force, Day of Defeat, the Day of Defeat logo, Counter-Strike, the Counter-Strike logo, Source, the Source logo, and Counter-Strike: Condition Zero are trademarks and/or registered trademarks of Valve Corporation. All other trademarks are property of their respective owners. © GameForest   Powered by IDeSys NetWorks