Reputation: 9941
I have the following sting that I need to localize for translation
<?php echo 'Click <a href="'. esc_url( get_permalink() ) . '">here</a> to go and wacth the video.' ?>
My problem is the <a href="'. esc_url( get_permalink() ) . '">here</a>
part in the middle of the sentence. I did try to break it up like this
<?php printf(__('Click %s to go and wacth the video.', 'pietergoosen'), '<a href="'. esc_url( get_permalink() ) . '">here</a>'); ?>
This works, but the word here
inside the <a>
tag then can't be translated.
Any suggestions how this can be solved
Upvotes: 0
Views: 37
Reputation: 25071
You can split the tag into two separate strings:
printf(__('Click %shere%s to go and wacth the video.', 'pietergoosen'), '<a href="'. esc_url( get_permalink() ) . '">', '</a>');
Upvotes: 1