Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter esqualli

    (@esqualli)

    So… anyone could help me? Anyone needs to use the default language instead of the secondary ones?

    Thanks!

    Thread Starter esqualli

    (@esqualli)

    I don’t know why but now does not show the blank page, but still doesn’t show the default post…

    The code i put in the functions.php with the Functionality plugin is this:

    add_filter( 'pre_get_posts', 'get_default_language_posts' );
     function get_default_language_posts( $query ) {
       if ( $query->is_main_query() && function_exists('pll_default_language') && !is_admin()){
         $terms = get_terms('post_translations'); //polylang stores translated post IDs in a serialized array in the description field of this custom taxonomy
         $defLang =  pll_default_language(); //default lanuage of the blog
         $curLang =  pll_current_language(); //current selected language requested on the broswer
         $filterPostIDs = array();
         foreach($terms as $translation){
           $transPost = unserialize($translation->description);
           //if the current language is not the default, lets pick up the default language post
           if($defLang!=$curLang) $filterPostIDs[]=$transPost[$defLang];
         }
         if($defLang!=$curLang){
           $query->set('lang' , $defLang.','.$curLang);  //select both default and current language post
           $query->set('post__not_in', $filterPostIDs); // remove the duplicate post in the default language
         }
       }
       return $query;
    }

    Thanks for your help!

    Thread Starter esqualli

    (@esqualli)

    This is what the debug returned

    Notice: Use of undefined constant E_USER_DEPRECATED - assumed 'E_USER_DEPRECATED' in /usr/home/suvisa/www/wordpress/wp-content/plugins/codestyling-localization/codestyling-localization.php on line 2491
    
    Notice: Trying to get property of non-object in /usr/home/suvisa/www/wordpress/wp-content/themes/kallyas/header.php on line 147
    Thread Starter esqualli

    (@esqualli)

    Hi!

    Can anyone could help me with the trouble of showing posts only in the default language?

    Thanks!

    Thread Starter esqualli

    (@esqualli)

    Thanks a lot Chrystl.

    That plugin helps me understanding the way to use .po and .mo files with plugins, themes,etc… in the theme aren’t created the files for the languages we want, i copied the files inside wp-content/languages and edit them before uploading to the theme folder. It’s all ok right now!

    Thanks a lot!

    Thread Starter esqualli

    (@esqualli)

    In my theme options there are an option to show the WPML language switch, there aren’t any other option about this, only Show or Hide it.

    Thread Starter esqualli

    (@esqualli)

    You can enter to http://www.suvisa.es/wordpress. Only in Spanish the switch is show in this language, in the other languages always show “Languages”.

    Thanks!

Viewing 7 replies - 1 through 7 (of 7 total)