Jump to content
Sign in to follow this  
peters_publishing

MultiLanguage in WhiteHouse

Recommended Posts

peters_publishing

I'd like to use WPML in WhiteHousePro, and particularly, I'd like to have a language switcher in the header. I tried using the instructions you'll find here: http://www.openscriptsolution.com/2010/07/11/how-to-replicate-the-footer-language-switcher-menu-in-order-to-display-it-also-at-the-very-top-of-site-by-using-wpml-plugin-of-wordpress/ but it causes total meltdown. Is there something different I should be doing to make this work with WhiteHousePro?

Share this post


Link to post
Share on other sites
cmunns

What did the meltdown look like? We have had other customers use this plug-in successfully so my guess is the code was incomplete

Share this post


Link to post
Share on other sites
peters_publishing

WPML actually works fine, it's the instructions I followed for inserting the code into the header that failed. I'm wondering if it has to do with how CSS is called in the header. The instructions I followed were written for 2010, which appears to have a more simple CSS call. Unfortunately, I don't remember exactly what the melt down looked like. It was just a bunch of raw code showing up in the header. I may have to re-create it to show you.

Share this post


Link to post
Share on other sites
cmunns

Raw code just means the page has a missing tag somewhere. If you want to show me where you placed it I can tell you if it's correct or not. :)

Share this post


Link to post
Share on other sites
peters_publishing

It's worse than I thought. Here's all I get now on the page when I follow those instructions:

// In order to display language selector of WPML plugin in footer/header of theme function languages_list_footer(){ $languages = icl_get_languages('skip_missing=0&orderby=code'); if($l['icl_lso_native_lang']){ $lang_native_hidden = false; }else{ $lang_native_hidden = true; } if($l['icl_lso_display_lang']){ $lang_translated_hidden = false; }else{ $lang_translated_hidden = true; } if(!empty($languages)){ echo '
	'; // <-- adjust this "lang_sel_footer" with the style that exists in language-selector.css file that belongs to WPML plugin (based on the version you are currently using). foreach($languages as $l){ if($l['country_flag_url']){ echo ' '; echo ''.$l['language_code'].' '; if(!$l['active']) echo ' '; } echo ' '; echo icl_disp_language($l['native_name'], $l['translated_name'],$lang_native_hidden); if(!$l['active']) echo ' '; } echo '
	'; } }
	Warning: Cannot modify header information - headers already sent by (output started at /home1/asbesto8/public_html/ar/wp-content/themes/WhiteHousePro/functions.php:28) in /home1/asbesto8/public_html/ar/wp-admin/theme-editor.php on line 89
Here's where I placed the Header part of the code:
<!-- Stylesheets -->
	    <link rel="stylesheet" href="<?php echo CORE_CSS.'/reset.css';?>" type="text/css" media="screen" />
	    <link rel="stylesheet" href="<?php echo CORE_CSS.'/wp_core.css';?>" type="text/css" media="screen" />
	    <link rel="stylesheet" href="<?php echo THEME_ROOT.'/style.css';?>" type="text/css" media="screen" />
	
	<?php if(VPRO):?><link rel="stylesheet" href="<?php echo PRO_CSS.'/pro.css';?>" type="text/css" media="screen" />
	<?php endif; ?>
	
	<?php if(VPRO  && pagelines('colorscheme', $post->ID) == 'black'):?><link rel="stylesheet" href="<?php echo PRO_CSS.'/color_black.css';?>" type="text/css" media="screen" /><?php endif;?>
	<?php if(VPRO  && pagelines('colorscheme', $post->ID) == 'green'):?><link rel="stylesheet" href="<?php echo PRO_CSS.'/color_green.css';?>" type="text/css" media="screen" /><?php endif;?>
	<?php if(VPRO  && pagelines('colorscheme', $post->ID) == 'orange'):?><link rel="stylesheet" href="<?php echo PRO_CSS.'/color_orange.css';?>" type="text/css" media="screen" /><?php endif;?>
	<?php if(VPRO  && pagelines('colorscheme', $post->ID) == 'red'):?><link rel="stylesheet" href="<?php echo
	PRO_CSS.'/color_red.css';?>" type="text/css" media="screen" /><?php endif;?>
	
	<link rel="stylesheet" href="<?php echo WP_PLUGIN_URL; ?>/sitepress-multilingual-cms/res/css/language-selector.css" type="text/css" media="all" />
	<?php languages_list_footer(); ?>
I also tried it above the "Pro" part, and had the same issue. I placed the function part here:
<?php
	
	// Theme Initialization -- Copyright PageLines 2010 -- Designed by Andrew Powers --
	
	// GET CORE ///////////
	
	    if(file_exists(TEMPLATEPATH.'/_core/init_core.php')){
	        define('CORE', TEMPLATEPATH . "/_core");
	        define('CORENAME', "_core");
	    }else{
	        define('CORE', TEMPLATEPATH . "/core");
	        define('CORENAME', "core");
	    }
	    include(CORE . "/init_core.php");
	
	?>
	
	// In order to display language selector of WPML plugin in footer/header of theme
	function languages_list_footer(){
	    $languages = icl_get_languages('skip_missing=0&orderby=code');
	    if($l['icl_lso_native_lang']){
	        $lang_native_hidden = false;
	    }else{
	        $lang_native_hidden = true;
	    }
	    if($l['icl_lso_display_lang']){
	        $lang_translated_hidden = false;
	    }else{
	        $lang_translated_hidden = true;
	    }
	    if(!empty($languages)){
	        echo '<div id="lang_sel_footer">'; // <-- adjust this "lang_sel_footer" with the style that exists in language-selector.css file that belongs to WPML plugin (based on the version you are currently using).
	        foreach($languages as $l){
	            if($l['country_flag_url']){
	                echo ' ';
	                echo ' ';
	                if(!$l['active']) echo ' ';
	            }
	            echo ' ';
	            echo icl_disp_language($l['native_name'], $l['translated_name'],$lang_native_hidden);
	            if(!$l['active']) echo ' ';
	        }
	        echo '</div>';
	    }
	}[/code]

Share this post


Link to post
Share on other sites
cmunns

I still think it's just incomplete somewhere and thus showing up as raw code. Did you try running the page throught the W3C validator. I can do it if you give me a link to the site.

Share this post


Link to post
Share on other sites
cmunns

The problem right now is that all that is actually above the `` tag. This needs to be inside of the head tag to take effect.

Share this post


Link to post
Share on other sites
peters_publishing

Hmm... As far as I can tell, it was definitely between the <head> and </head> tags, just below the css call.

Share this post


Link to post
Share on other sites
cmunns

Did you try placing it in the "header scripts" portion of the THEME OPTIONS > CUSTOM CODE area? This may eliminate some of the variables on placement, then we can know for sure if the code itself is missing something

Share this post


Link to post
Share on other sites
bryan-hadaway

Please hold tight for continued developer help in the morning. Bump your topic. Thanks, Bryan

Share this post


Link to post
Share on other sites
cmunns

I see...only this ` <?php languages_list_footer(); ?> ` Goes in the header. The other part goes in the functions.php files as instructed by the initial link you provided. i think you've placed the lot of it in the header

Share this post


Link to post
Share on other sites
peters_publishing

Nope, I divided the header bit into the header, and the functions bit into functions php. You can see exactly where I have it placed in Functions in one of my earlier posts above.

Share this post


Link to post
Share on other sites
bryan-hadaway

Bumping for you... don't want to drown you in other answers. Bump again tonight. Thanks, Bryan

Share this post


Link to post
Share on other sites
cmunns

Here's what I get: ` <?php get_template_part ('library/dynamic_css'); ?> <?php wp_enqueue_style('ie7-style', THEME_CSS . '/ie7.css'); global $wp_styles; $wp_styles->add_data( 'ie7-style', 'conditional', 'lte IE 7' ); ?> <?php languages_list_footer(); ?> ` (there on the bottom portion of CSS calls in header.php) and... ` <?php // Theme Initialization -- Copyright PageLines 2010 -- Designed by Andrew Powers -- // GET CORE /////////// if(file_exists(TEMPLATEPATH.'/_core/init_core.php')){ define('CORE', TEMPLATEPATH . "/_core"); define('CORENAME', "_core"); }else{ define('CORE', TEMPLATEPATH . "/core"); define('CORENAME', "core"); } get_template_part("core/init_core"); function languages_list_footer(){ $languages = icl_get_languages('skip_missing=0&orderby=code'); if($l['icl_lso_native_lang']){ $lang_native_hidden = false; }else{ $lang_native_hidden = true; } if($l['icl_lso_display_lang']){ $lang_translated_hidden = false; }else{ $lang_translated_hidden = true; } if(!empty($languages)){ echo '

'; // <-- adjust this "lang_sel_footer" with the style that exists in language-selector.css file that belongs to WPML plugin (based on the version you are currently using). foreach($languages as $l){ if($l['country_flag_url']){ echo ' '; echo ''.$l['language_code'].' '; if(!$l['active']) echo ' '; } echo ' '; echo icl_disp_language($l['native_name'], $l['translated_name'],$lang_native_hidden); if(!$l['active']) echo ' '; } echo '
'; } } ?> ` (entire functions.php file) and it shows up happily in the header.php...perhaps redo it with the exact code I have here?

Share this post


Link to post
Share on other sites
peters_publishing

Cool, I'll give it a try with that code this evening and let y'all know what happens. Thanks for all the help so far.

Share this post


Link to post
Share on other sites
peters_publishing

Close, but not quite. I inserted the code above on another test site, just because I had messed with the other so much, and wanted to be sure some other change I had made wasn't the cause of my continued issues. The area for the selector is now created in the header, and the name of the languages is there, but you cannot select a language, and the flags don't appear. See it here: http://ar.skypeenglishclasses.com/

Share this post


Link to post
Share on other sites
cmunns

I just extracted all the plugin files and don't even see a function for languages_list_footer(), that may be part of the problem...maybe the code you got was old but I think you need to use this function instead ` function wpml_languages_list($skip_missing=0, $div_id = "lang__sel_footer"){ if(function_exists('icl_get_languages')){ $languages = icl_get_languages('skip_missing='.intval($skip_missing)); if(!empty($languages)){ echo '

  • '; foreach($languages as $l){ echo '
  • '; if(!$l['active']) echo ''; echo ''.$l['language_code'].''; if(!$l['active']) echo ''; if(!$l['active']) echo ''; echo $l['native_name']; if(!$l['active']) echo ' ('.$l['translated_name'].')'; if(!$l['active']) echo ''; echo ''; } echo '
'; } } } ` Then of course in the header you use the name of the function above instead of the old one.

Share this post


Link to post
Share on other sites
cmunns

The current error is because the function is lang_sel_footer(), i did have a typo in there with an extra underscore. At any rate if you want me to take a look email me your info.

Share this post


Link to post
Share on other sites
peters_publishing

Cool. Your email is?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×