Join the Soledad Facebook Users Group here
for Share, assistance, discussion, and Updates related to Soledad WordPress Theme.

If you can't create a new ticket - you can send us an email via our contact form and we will get back to you.

Okay
  Public Ticket #1945584
Polylang string translation
Closed

Comments

  • Igorz16 started the conversation

    Hi, I want to add Polylang string translations in different parts on theme, for example the privacy policy bar, I added a custom string, then I tried to add it to the bar, without any result, it is blank. I tried to add the string with these methods:

    <?php echo pll_e('privacypolicy'); ?>

    <?php echo pll__('privacypolicy'); ?>

    echo pll_e('privacypolicy');

    echo pll__('privacypolicy');

    How can I do? Thank you

  •  501
    Penci replied

    Hi,

    "pll_e" function translates a string previously registered with "pll_register_string" function http://prntscr.com/n24e32.

    Please register string  with "pll_register_string" function before use "pll_e" function.

    Please checkthis guide to know how to use function of polylang plugin 

    Best Regards,

    PenciDesign

  • Igorz16 replied

    Hi,

    I registered correctly, but it doesn't appear, how can I use it? With <?php ?> or without it? Thank you

  •  501
    Penci replied

    Hi,

    Please send me your custom code you registered string. I will check it help you.

    Or  send me your website managment information ( admin url site, username and password ) in order for me to have access to know the exact issue. We will take it a lock on this help you.

    Best Regards,

    PenciDesign

  • Igorz16 replied

    I registered the string correctly, I only need to know what I have to use in the customize panel, if I have to put <?php?> or directly the function or other symbols, because they don't work, for example "echo 'something';" doesn't work, neither with <?php ?>

  •  501
    Penci replied

    Hi,

    Do you want use in the customize panel like screenshot http://prntscr.com/n37bpu

    If right, please add  custom code to register customize panel  on function.php file 

     http://prntscr.com/n37df7http://prntscr.com/n37dq5http://prntscr.com/n37dze

    add_action('customize_register', 'themename_customize_register');
    function themename_customize_register($wp_customize){
    $sanitizer = new Penci_Customize_Sanitizer(); $wp_customize->add_section( 'penci_section_transition_custom_text', array(
    'title'       => esc_html__( 'Custom Text with Translation', 'pennews' ),
    'description' => sprintf(
    esc_html__( 'Use shortcode [pencilang] with multiple languages site (ex: [pencilang en_US='Share' fr_FR='Partager' language_code='Your language text' /]). You can check language code %s', 'pennews' ),
    '' . esc_html__( 'here', 'pennews' ) . ''
    ),
    'priority'    => 1,
    ) ); $wp_customize->add_setting( 'id_option_tran_custom_text', array(
    'sanitize_callback' => array( $sanitizer, 'html' ),
    'default'           => 'something',
    ) );
    $wp_customize->add_control( 'id_option_tran_custom_text', array(
    'label'    => 'Text: "Custom text"',
    'section'  => 'penci_section_transition_custom_text',
    'settings' => 'id_option_tran_custom_text',
    'type'     => 'text',
    ) ); $wp_customize->add_setting( 'id_option_tran_custom_text2', array(
    'sanitize_callback' => array( $sanitizer, 'html' ),
    'default'           => 'something2',
    ) );
    $wp_customize->add_control( 'id_option_tran_custom_text2', array(
    'label'    => 'Text: "Custom text 2"',
    'section'  => 'penci_section_transition_custom_text',
    'settings' => 'id_option_tran_custom_text2',
    'type'     => 'text',
    ) );
    }

    Usage
    <?php
    echo penci_get_tran_setting( 'id_option_tran_custom_text' );
    echo penci_get_tran_setting( 'id_option_tran_custom_text2' ); ?>


    Best  Regards,

    PenciDesign