Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have added a link on the footer of my page in the format

<a href="URL">Link</a>

I would like to allow wmpl to translate it in french and have tried scanning my theme but the link's text doesn't appear in the string translation manager in the dashboard.

After reading this: http://wpml.org/faq/language-setup/ I have tried wrapping the link in gettext but do not know how to add an href link into this line of Php:

How could I do that?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

You need to put your strings in translatable format.

<a href="URL"><?php _e( 'Link', 'your-theme-text-domain'); ?></a>

Function reference: _e(), this one echoes the value, for assignment, use $my_string = __( 'String', 'text-domain' );.

Also, check the following documentation: WordPress_in_Your_Language#Introduction and WPML - Getting String Translation to Work.

share|improve this answer
add comment

Although @brasofilo already has given the correct answer, I would like to point out that WPML offers another way to displaying a link (to content within your website).

Say that you would like a link in the footer going to the About (with an ID of 3) page, you could code that as follows:

Using icl_link_to_element(ID, type, text, arguments, anchor):

<?php icl_link_to_element(3,'page',__('Read more about us', 'textdomain')); ?> More information on that via WPML.

Hope this helps.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.