[Support request] "Read more" button

Home Forums Support [Support request] "Read more" button

Home Forums Support "Read more" button

Viewing 15 posts - 1 through 15 (of 29 total)
  • Author
    Posts
  • #395428
    Sergei

    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.

    #395606
    Tom
    Lead Developer
    Lead Developer

    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.

    #395925
    Sergei

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

    #396054
    Leo
    Staff
    Customer Support
    #396330
    Sergei

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

    #396382
    Sergei

    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’ )
    )
    }

    #397049
    Tom
    Lead Developer
    Lead Developer

    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;
    
    }
    #397109
    Sergei

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

    #397379
    Tom
    Lead Developer
    Lead Developer

    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?

    #397814
    Sergei

    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.

    #398000
    Tom
    Lead Developer
    Lead Developer

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

    #398110
    Sergei

    Im using qtranslate-x plugin.

    #398609
    Tom
    Lead Developer
    Lead Developer

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

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

    #411996
    Sergei

    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.

    #412144
    Tom
    Lead Developer
    Lead Developer

    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.

Viewing 15 posts - 1 through 15 (of 29 total)
  • You must be logged in to reply to this topic.