Skip Navigation

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 8 replies, has 2 voices.

Last updated by Bruno 8 years, 3 months ago.

Assigned support staff: Bruno.

Author Posts
August 13, 2013 at 8:15 pm #154524

Deoraj Peter

Hi, after I upgrade WPML, the blog title isn't translated.

I tried to use string translation.
The old version (I bought it 2011) translate blog tilte very well.

this is the code i used in head.php
<div class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></div>

August 13, 2013 at 8:21 pm #154526

Deoraj Peter

I could use
<?php
if(ICL_LANGUAGE_CODE=='en'){ ?>English Title<?php }
if(ICL_LANGUAGE_CODE=='fr'){ ?>French Title<?php } ?>

but I prefer to use <?php bloginfo( 'name' ); ?>

thanks,

August 13, 2013 at 8:46 pm #154530

Bruno

Dear Deoraj,

Please, try this one:

<div class="site-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( icl_translation('wpml_custom', 'wpml_custom_title', get_bloginfo( 'name', 'display' ) ) ); ?>" rel="home"><?php echo icl_translation('wpml_custom', 'wpml_custom_title', get_bloginfo( 'name' ) ); ?></a>
</div>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Thank you.

August 14, 2013 at 3:17 pm #154817

Deoraj Peter

hi,bruno,

thanks for response. I tried, but it didn't work. the code after this line doesn't render.

August 14, 2013 at 3:40 pm #154825

Bruno

Dear Deoraj,

Sorry, I was wrong in the function syntax. It's icl_translate not icl_translation as I had posted.

Try this one:

<div class="site-title">
<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php echo esc_attr( icl_translate('wpml_custom', 'wpml_custom_title', get_bloginfo( 'name', 'display' ) ) ); ?>" rel="home"><?php echo icl_translate('wpml_custom', 'wpml_custom_title', get_bloginfo( 'name' ) ); ?></a>
</div>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Thank you.

August 14, 2013 at 6:34 pm #154852

Deoraj Peter

thank you! Bruno. It works!
another related issue is that I use bloginfo in <title> tag. My code is here:
<title><?php wp_title('|',true,''); ?></title>

but I got "French post title | English site title" in my French site. How can I get "french post title | French site title"?
I could use:
<title><?php echo get_the_title(); ?> | <?php echo icl_translate('wpml_custom', 'wpml_custom_title', get_bloginfo( 'name' ) ); ?></title>

Just wondering if you have better clean code?

thanks,

August 14, 2013 at 8:55 pm #154871

Bruno

Dear Deoraj,

Please, try this one:

//functions.php
function wpml_custom_wp_title( $title, $sep ) {
	global $paged, $page;

	if( function_exists( 'icl_translate') ) {
		$title = icl_translate('wpml_custom', 'wpml_custom_' . sanitize_key($title), $title);
	}

	return $title;
}
add_filter( 'wp_title', 'wpml_custom_wp_title', 10, 2 );
//header.php
<title><?php wp_title('|',true,''); ?></title>

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Thank you.

August 15, 2013 at 1:30 pm #155058

Deoraj Peter

It's not working. I still got "French post title | English site title" in my French site.
thanks,

August 15, 2013 at 7:47 pm #155134

Bruno

Dear Deoraj

Are you using any SEO plugin? This seems to have some other plugin handling the title.

Please check if you do not have any plugin to edit the title.

Thank you.

The topic ‘[Closed] Blog Title doesn't translate’ is closed to new replies.