Site logo

Archived topic

how to translate the previous/next button(wp show post)

7 replies · Started by d on June 28, 2019

Viewing posts 1–8 of 8

Hi there,

1. Translations can be made here: https://translate.wordpress.org/projects/wp-themes/generatepress/

Alternatively, you can use a function like this:

add_filter( 'gettext', function( $text ) {
    if ( 'Previous' === $text ) {
        $text = 'Your new text';
    }

    if ( 'Next' === $text ) {
        $text = 'Your new text';
    }

    return $text;
} );

2. There are a couple of things you need to do here:

First, add this PHP:

add_filter( 'generate_start_widget_title', function() {
    return '<h2 class="widget-title"><span>';
} );

add_filter( 'generate_end_widget_title', function() {
    return '</span></h2>';
} );

Then, add this CSS:

.sidebar .widget .widget-title {
    border-bottom: 1px solid red;
    padding: 10px 0;
}

.sidebar .widget .widget-title span {
    background: red;
    color: #fff;
    padding: 10px;
}

3. Not sure if that will work, but you can try:

add_filter( 'comment_form_default_fields', function( $fields ) {
    unset( $fields['author'] );
    unset( $fields['email'] );

    return $fields;
}, 50 );

Thanks. Tom
but the 1st code isn't work.
maybe,because need to translate the wp-show-post plugin.
(when I install Loco Translate plugin to translate the text,but there isn't .pot file)

Source files to scan: 54 (194.6 KB on disk, largest is 29.6 KB)

Strings will be extracted to: plugins/wp-show-posts/wp-show-posts.pot

the "previous","next" is outputed by the wp-show-post plugin code.
so, is there anyway to solve it?
https://prntscr.com/o7uuxj

Ah, in that case, you would do this:

add_filter( 'gettext', function( $text ) {
    if ( '&larr; Previous' === $text ) {
        $text = 'Your new text';
    }

    if ( 'Next &rarr;' === $text ) {
        $text = 'Your new text';
    }

    return $text;
} );

Thanks.Tom
it is work

You're welcome :)

Hi there I have a similar problem. I tried to follow the solutions presented in this thread but I was not able to make it work. My site is http://www.finfin.sk

I would like to translate Previous / Next navigation in the Blog.

I can see that this translation is missing in the Generatepress https://translate.wordpress.org/projects/wp-themes/generatepress/

So I have translated it and added it.
https://prnt.sc/wlqnpr

Could you please upload the translation? So it will show across all GP websites written in Slovak language?

Hi there,

Any chance you can open a new topic? This one was WP Show Posts specific.

Thanks!

This archived topic is closed to new replies.