Site logo

Archived topic

"Read more" button

28 replies · Started by Sergei on October 1, 2017

Viewing posts 1–15 of 29

Hey all and Tom. I have question about "Read more" button. I wish to transle it in another two languages, but i have already translated in .po file, but no showing in website. Only can change in one language through custimization.

Try adding this:

add_filter( 'generate_excerpt_more_output', 'tu_translatable_read_more' );
function tu_translatable_read_more() {
    printf( ' ... <a title="%1$s" class="read-more" href="%2$s">%3$s</a>',
        the_title_attribute( 'echo=0' ),
        esc_url( get_permalink( get_the_ID() ) ),
        __( 'Read more', 'generate-blog' )
    )
}

That should force it to use the .po file instead of the Customizer setting.

Where can i put this code? In functions.php and additional css doesnt work for me.

When i add this code in my child theme functions.php , my website shuts down with error.

And one more question - how to translate Masonry +More button and Loading. And mobile Menu button.

Still waiting help for "Read More" button. Really dont know where to put that code

add_filter( 'generate_excerpt_more_output', 'tu_translatable_read_more' );
function tu_translatable_read_more() {
printf( ' ... %3$s',
the_title_attribute( 'echo=0' ),
esc_url( get_permalink( get_the_ID() ) ),
__( 'Read more', 'generate-blog' )
)
}

Try this instead:

add_filter( 'option_generate_blog_settings', 'tu_translatable_blog_strings' );
function tu_translatable_blog_strings( $options ) {

    $options['read_more'] = __( 'Read more', 'generate-blog' );
    $options['masonry_load_more'] = __( '+ More','generate-blog' );
    $options['masonry_loading'] = __( 'Loading...','generate-blog' );

    return $options;

}

Added in child themes functions.php , still no results.

What that function does is bypass the Customizer options so the .po file is used again. I assume you've added your custom .po file (generate-blog text domain) with the translations?

I have three translated .po files. They doesn`t work for me. Because first start working Customizer options. So, what i write in Customizer, thats shows in all languages, that same word. Website no taking information from .po files but from Customizer first. Sorry for my english.

How are you showing the two other languages? Are you using a multilingual plugin?

Hmm, I don't have much experience with it.

Have you asked them why it wouldn't be working in this case?

Hey again. Still dont resolve my problem.

add_filter( 'option_generate_blog_settings', 'tu_translatable_blog_strings' );
function tu_translatable_blog_strings( $options ) {

    $options['read_more'] = __( 'Read more', 'generate-blog' );
    $options['masonry_load_more'] = __( '+ More','generate-blog' );
    $options['masonry_loading'] = __( 'Loading...','generate-blog' );

    return $options;

}

Added this one im my child theme functions.php no results. In wp_contetnt/languages/themes added russian and latvian .po files still nothing. When i change in that code which are in functions.php "Read More" to "Lasīt vairāk" then it looks same in 3 languages no saperate. In EN "Read More", LV "Lasīt vairāk" utc. I dont know hoe to fix that problem.

Those strings aren't translatable in that folder. GP Premium translations are in wp-content/plugins/gp-premium/langs

However, you'd be better off using a plugin like Say What along with that function.

This archived topic is closed to new replies.