• Resolved pabloplazalastras

    (@pabloplazalastras)


    Hi, I have successfully added Polylang to customizr and I have set up my site in Spanish and English, but the only thing I don’t know how to do is to make the ‘read more’ link under each feature page to change (‘Read more’ on English pages and ‘Leer más’ in Spanish pages).
    The only thing I can see that you can do with that link is to change the ‘Read More’ text in the Theme customization, but that would change in all the pages, both Spanish and English.

    Any idea?
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pabloplazalastras

    (@pabloplazalastras)

    Actually I fixed it my myself.

    I got the snippet from https://www.themesandco.com/snippet/different-texts-featured-pages-buttons/ and added the if condition on page which is my Spanish page ID

    the code I used is:

    add_filter( ‘tc_fp_button_text’ , ‘my_button_text’ , 10 , 2 );
    function my_button_text( $original_text , $fp_id ) {

    if (is_page( 8 )) {
    $my_texts = array(
    ‘one’ => ‘Leer Más’,
    ‘two’ => ‘Leer Más’,
    ‘three’ => ‘Leer Más’
    );
    }
    else
    {
    $my_texts = array(
    ‘one’ => ‘Read More’,
    ‘two’ => ‘Read More’,
    ‘three’ => ‘Read More’
    );
    }
    return isset( $my_texts[$fp_id] ) ? $my_texts[$fp_id] : $original_text ;
    }

    It should appear in the Polylang string translations.

    If I recall correctly, you need to have actually set the button text in Appearance > Customize, however. Otherwise it will pick up the default translation for your WordPress installation.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘'Read More' on Featured Pages in Spanish’ is closed to new replies.