Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

Aureola on "How do you translate ( __('string') or _e('string') ) strings inside a function?"

$
0
0

Hi,
Surely I have made some typical newbie syntax error but I have tried just about everything. I would like to send off the words 'Read More' to the PO Editor for translation later; these words reside in this function:
(functions.php)

The original function for Read More - this one works but can't be translated:

function excerpt_ellipse($text) {  // custom 'read more' link
   return str_replace('[&hellip;]', '<a href="'.get_permalink().'">... READ MORE »</a>', $text); }
add_filter('the_excerpt', 'excerpt_ellipse');

This would be the internationalized function for Read More:

function excerpt_ellipse($text) {  // custom 'read more' link
   return str_replace('[&hellip;]', '<a href="'.get_permalink().'">... <strong><?php _e('</strong>READ MORE »',<strong>'ctequestrian') ?></strong> </a>', $text); }
add_filter('the_excerpt', 'excerpt_ellipse');

I have tried with and without the beginning/trailing <?php/?>, both with __( and _e( but I just can't get it to work. I have read about gettext in the Codex (http://codex.wordpress.org/I18n_for_WordPress_Developers) and several other tutorials but obviously I couldn't make use of them in this particular situation. In all other cases (simple strings of text in headlines and paragraphs) this _e( have worked fine.

Maybe someone here can help..?


Viewing all articles
Browse latest Browse all 8245

Trending Articles