Support » Plugin: Translate Multilingual sites - TranslatePress » I would like to hide the floating language switcher on some specific pages

  • First of all,
    Great plugin, the best I found so far. Big thanks!
    How can I hide the floating language switcher on some specific pages?
    That would be awesome
    Thx again

    Mike

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Dragos

    (@dragosvrejiu)

    Hello Mike,

    I’m sorry for the late reply.

    You can exclude pages from being translated using the following custom code:

    Create an empty plugin like this: https://gist.github.com/sareiodata/76f701e01db6685829db

    Add(and change the arrays with your desired slug pages that you want to exclude) the following code to the end of it:

    
    add_action( 'plugins_loaded', 'trpc_exclude_tp_from_pages', -1 );
    function trpc_exclude_tp_from_pages(){
        $do_not_translate_path = array('contact');
    	$do_not_translate_path = array('home');
    	$do_not_translate_path = array('test-page-page');
    
        foreach ( $do_not_translate_path as $path ){
            if ( !empty($path) && strpos($_SERVER['REQUEST_URI'], untrailingslashit($path)) !== false ){
                add_filter( 'trp_allow_tp_to_run', function(){return false; } );
            }
        }
    }

    Install it via FTP or activate it via WordPress like any other plugin.

    Please let me know if this approach suits your needs!

    Regards,

    Thread Starter maik2558

    (@maik2558)

    Thank you Dragos
    BR
    Mike

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘I would like to hide the floating language switcher on some specific pages’ is closed to new replies.