• Advanced Menu Widget is a very good plugin which allows you to make menus in admin widget, based on one of your registered menus, but with many other options like start depth of hierarchy.
    I am making multi-language site now, and using this plugin with qTranslate multi-language plugin.
    I have noticed some things in the work of this plugin, which I wanted to fix.
    One of them was converting the links hrefs to current language (qtrans_convertURL), when the menu item is custom link. Second feature is hiding from menu items, that does not have translated versions for current language. So the solving of this bugs is: search for advanced-menu-widget.php in plugins directory, find the display_element() function in it and add some code after: (line 84)

    if ( !$element )
    			return;

    The new code is:

    if ( !$element )
    			return;
    
    		if (function_exists('qtrans_getLanguage')):
    			if (!qtrans_isAvailableIn($element->object_id, qtrans_getLanguage()))
    		        return;
    
    		    if ($element->type == 'custom') {
    		        if (parse_url($element->url, PHP_URL_HOST) == '') {
    		    		$element->url = qtrans_convertURL($element->url);
    		    	}
        		}
    		endif;
    
    		$id_field = $this->db_fields['id'];

    But notice, this code will work, if you made your current link adress without URL_HOST past (it is internal site link, like “/news/”).
    If you don`t need in hiding untranslated items, remove

    if (function_exists('qtrans_getLanguage')):
    			if (!qtrans_isAvailableIn($element->object_id, qtrans_getLanguage()))
    		        return;

  • The topic ‘[plugin: Advanced Menu Widget] Fixing some problems with qTranslate’ is closed to new replies.