• Resolved Alan Spinn

    (@asr77)


    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? I wanted to contact Ronny but he’s site is not in english Unfortunally And I don’t speak Hebrew ??

    <?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;
    }
    ?>

    Thanks a lot Allan

    https://www.ads-software.com/plugins/qtranslate-x/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Gunu

    (@grafcom)

    @alan Spinn,

    try qtranxf_getLanguage instead of qtrans_getLanguage

    Success

    Plugin Author Gunu

    (@grafcom)

    qTranslate remove one language menu item – plugin?

    @alan Spinn,

    what is it exactly that you want?

    Thread Starter Alan Spinn

    (@asr77)

    No success…. The plugin used with mqtranslate removed a menu (top menu) item when title field was left empty. E.g. four languages – visible menu in three …german hidden.

    Any other way?

    Best

    Plugin Author Gunu

    (@grafcom)

    @alan Spinn,

    Looking for something like this?

    Scroll down to section – hide certain menu entries.

    Thread Starter Alan Spinn

    (@asr77)

    Hi Gunu, found out this feature is built in now! In qtranslate-x. So no need for the plugin anymore for hiding menu items in one language, thanks! And sorry for the waste of your time.

    Thanks a lot

    Plugin Author Gunu

    (@grafcom)

    You are welcome!

    You can review this plugin to help other people to find out the value.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘qTranslate remove one language menu item – plugin?’ is closed to new replies.