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

Last updated by fabriceB-3 4 years, 5 months ago.

Assigned support staff: Joanna.

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


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


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


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


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


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

Capture d’écran 2017-08-16 à 08.47.13.png
August 16, 2017 at 4:13 pm #1344650


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:
You will get the custom assistance you need to get on with your project.
Before doing so please have a look also here:

August 16, 2017 at 4:38 pm #1344668


Ok thanks, I understand.