• Hi Ronny

    The following plugin code works with mq-translate but not with the excellent q-translate-x
    How could we change it for working with X?

    <?php
    /*
    Plugin Name: qTranslate remove one language menu item
    Plugin URI: https://www.hoojima.com
    Description: qTranslate - remove untranslated menu items from menu by simply removing the language string
    Version: 0.1
    Author: Ronny Sherer
    */
    if(!defined('WP_ADMIN'))
    	add_filter('wp_setup_nav_menu_item',		'myMenuExits', 5);
    
    function myMenuExits($obj)
    {
    	if (!function_exists('qtrans_getLanguage'))
    		return $obj;
    
    	static $lang = '';
    	if (empty($lang)) $lang = qtrans_getLanguage(); // Limit calls to qtrans_getLanguage to 1 call.
    	$strings = qtrans_split($obj->title);
    	//return empty($strings[$lang]) ? null : $obj;
    	if( empty($strings[$lang]) )
    	{
    		$obj->ID 		= '';
    		$obj->title 	= '';
    		$obj->post_name = '';
    		$obj->db_id 	= '';
    	}
    
    	return $obj;
    }
    ?>

    Hi Ronny hope you can help me out, guess its a very small change in the code?
    Best Allan …thanks a lot

    https://www.ads-software.com/plugins/qtranslate-remove-one-language-menu-item/

  • The topic ‘Changing for working with q-translate-x ?’ is closed to new replies.