Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * Qtranslate and Custom WordPress Menus
- * Install : Drop in your functions.php, or create a simple plugin (and drop all your functions there)
- * Description : Display translated page names in Wordpress custom menus configuration page
- * Author : chudoff.a in WP Forums -> http://goo.gl/7FW04
- * Observations : added an error prevention if(function_exists()), in case Qtranslate is inactive
- * Update March 2012 : the error prevention is preventing this hook to work :) with WP 3.3.1 and QT 2.5.28 - faulty lines disabled
- */
- // if ( function_exists("qtrans_useTermLib") ) {
- function qtrans_menuitem2( $item ) {
- foreach ($item as $key=>$values){
- $item[$key]->title = qtrans_useTermLib($values->title);
- }
- qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $item->title );
- return $item;
- }
- add_filter('wp_nav_menu_objects', 'qtrans_menuitem2', 0);
- function qtrans_menuitem( $menu_item ) {
- $menu_item->title = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage( $menu_item->title );
- $menu_item->title = qtrans_useTermLib( $menu_item->title );
- return $menu_item;
- }
- add_filter('wp_setup_nav_menu_item', 'qtrans_menuitem', 0);
- //}
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement