If you are having a notice about writing the .mo files please read this doc

Hi, Amit here, I am the WPML Support Manager, our current ticket queue is high, update your WPML plugins and make sure you meet the minimal requirements for running WPML before reporting an issue please - many tickets are resolved doing that

Please look at our updated list of Known Issues and you can also use our support search to find helpful information and of course review our documentation before opening a ticket.

If you do need to open a ticket please make sure to provide us with all the needed information as described in this page

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 6 replies, has 2 voices.

Last updated by fabriceB-3 2 years, 3 months ago.

Assigned support staff: Joanna.

Author Posts
August 11, 2017 at 7:28 am #1339965

fabriceB-3

Hi,
I have 2 strings that are not recognized by String Translation. This is because the words are not embedded into the echo function in the php.

See current code:
<span title="Previous project"><?php previous_post_link('%link', '<i class="fa fa-angle-left"> Prev'); ?> </span>

<span title="Next project"><?php next_post_link('%link', 'Next <i class="fa fa-angle-right">'); ?> </span>

I want to have "Prev" and "Next" recognized.

I have tried the following but that does not work (example for "Prev")

<span title="Previous project"><?php previous_post_link('%link', '<i class="fa fa-angle-left"> <?php _e('Prev', 'lupo'); ?>'); ?> </span>

Can you help me writing the code the right way pease?

Many thanks

August 11, 2017 at 6:20 pm #1340525

Joanna

Hello @fabriceb-3,

Please try the following code instead:

<?php previous_post_link('%link', '<span title="Previous project"><i class="fa fa-angle-left">' . __('Prev', 'lupo') . '</i></span>' ); ?>

Afterward, you may need to rescan your theme for strings in WPML->Theme and plugins localization.

August 15, 2017 at 6:31 am #1342381

fabriceB-3

Thanks Joanna. It works. How would you do for the "Next" button which has the following current code :

<span title="Next project"><?php next_post_link('%link', 'Next <i class="fa fa-angle-right">'); ?> </span>

I tried to adapt your logic but no success. Thanks

August 15, 2017 at 3:15 pm #1343755

Joanna

Hello @fabriceb-3,

You should use a similar code. Please try the following:

<?php next_post_link('%link', '<span title="Next project"><i class="fa fa-angle-right">' . __('Next', 'lupo') . '</i></span>' ); ?>
August 16, 2017 at 6:48 am #1344169

fabriceB-3

Thanks for your quick answer. The code you provided has 2 issues.
1) the arrow is placed before the text while it should be after
2) it does not take the class "fa fa-angle" into account
See screenshot
Best

August 16, 2017 at 4:13 pm #1344650

Joanna

Hello @fabriceb-3,

You may need to experiment with the order of HTML tags and the Gettext function you use to localize the "Next" word. You may also need to create a custom CSS rule that will take care of the URL position.

Please note that the URL styling (position of the arrow or the text itself) has nothing to do with WPML. At this point, it becomes a custom coding that is beyond the scope of our support.

Since the translation is working fine but the example code snippet doesn't get you the exact result that you want, I'd strongly recommend you to contact your theme's authors. They know their product and they should be able to help you quickly and more accurately.

If it's a custom made theme and you struggle with making it work as you wish, you may want to consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/
You will get the custom assistance you need to get on with your project.
Before doing so please have a look also here: http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

August 16, 2017 at 4:38 pm #1344668

fabriceB-3

Ok thanks, I understand.