Support » Plugin: Polylang » [Plugin: Polylang] Possibility to inactivate language

  • Resolved fmarie

    (@fmarie)


    Hi Chouby

    I have try to had an option to inactivate a language but I’m not so good…
    In my mind, I want to had in termmeta, a meta_key with _active and a meta_value with 1 or 0 and reference to language id with the term_id.
    that’s all done, I can do it !

    But… I don’t see where I can hide language in different select and language’s lists.

    Finally, I want to have possibility to access at language’s page by direct link but I don’t want to see language in a menu or list.

    Can you help me ? This is essential in my development !

    Many Thx !!

    http://wordpress.org/extend/plugins/polylang/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Chouby

    (@chouby)

    I am not sure I catched what you want to do.

    First you must know that the ‘language’ is a taxonomy. To get the list of languages, I always use the function ‘get_languages_list’ that you can find in base.php. This function is in fact a helper function which uses get_terms. So you can use all filters applied by this function:
    * get_terms_args
    * get_terms
    * terms_clauses

    Maybe the first one is the one you want. You can add an ‘exclude’ argument.

    Thread Starter fmarie

    (@fmarie)

    Ok Chouby.
    I see those points tomorrow.
    I wrote here if I found a solution who can add onto Polylang.

    Thread Starter fmarie

    (@fmarie)

    I have find something.

    Into base.php, I change the function get_language_list in line 25

    function get_languages_list($hide_empty = false) {
    		$lgtonotshow='';
    		if(!is_admin()){
    			$termslg=get_terms('language', array('hide_empty'=>true, 'orderby'=>'term_group', 'order'=>'ASC'));
    		foreach($termslg as $termlg){
    			if($termlg->term_group>999) $lgtonotshow .= $termlg->term_id.',';
    		}
    		}
    
    		return get_terms('language', array('hide_empty'=>$hide_empty, 'orderby'=>'term_group', 'exclude'=>$lgtonotshow ));
    	}

    I exclude all of term who are superior or egal at 1000 in term_group (order for PolyLang).
    That’s works !

    For prevent some bugs, don’t make same term_group for 2 languages.
    At the start, I try to make $termlg->term_group==0 but when 2 lang have the same term_group, they disappear.

    I hope this will help someone else.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Polylang] Possibility to inactivate language’ is closed to new replies.