Theme Support Forum

Support Forum for Free and Premium Themes. Premium Theme Forums are Private! Please log in first to see the Premium forums

If you Like the Asteria Lite Theme and want to Keep it free forever Please Rate it on Wordpress.org (It only takes a few seconds)
Viewing 16 posts - 1 through 16 (of 16 total)

Tranlsation of Frontpage

Home Forums Free Theme Support Asteria Lite Tranlsation of Frontpage

  • #152619

    Saad

    Hi towfiqi,

    First of all excellent work with the theme. Its really easy to use and very nice. I just had one question. I wanted to translate the frontpage. I’m using the plugin polylang. It seems that the only way possible in that is to have the homepage set to a static page and then having two language versions of it. But how can I have two versions of your front page with the blocks and the slider and everything?

    Thanks

    #153140

    Towfiq I.

    administrator

    open up functions.php and add this:

    // [polylang lang="en"]English[/polylang][polylang lang="sp"]Spanish[/polylang]
    function polylang_shortcode($atts, $content = null)
    {
    	if (empty($content))
    		return '';
    	extract( shortcode_atts( array('lang' => ''), $atts ) );
    	if (empty($lang))
    		return "<h3>You must specify 'lang' using shortcode: polylang</h3>";
    
    	return ($lang == pll_current_language()) ? $content : '';
    }
    add_shortcode('polylang', 'polylang_shortcode');

    before this:

    //Asteria Site title

    Then you can use this shortcode to in the welcome text box and blocks:

    [polylang lang="en"]My English Text[/polylang][polylang lang="sp"]My Spanish Text[/polylang]

    #225144

    Admin KPasapp

    There is a small error in the code (see below), but after correction, it still doesn’t work for the slides and for the block titles. It works for Welcome text and block content.
    Should another shortcode be used in titles & slides?
    You can see the issue here: http://eventodos.com/test1/en/
    Please note that shortcode was applied only to 2nd slide, welcome text and block 1, 2 & 3

    Another issue:
    How blocks url should be managed for English and Spanish urls?

    The correct code is:
    // [polylang lang=”en”]English[/polylang][polylang lang=”es”]Español[/polylang]
    function polylang_shortcode($atts, $content = null)
    {
    if (empty($content))
    return ”;
    extract( shortcode_atts( array(‘lang’ => ”), $atts ) );
    if (empty($lang))
    return “<h3>You must specify ‘lang’ using shortcode: polylang</h3>”;

    return ($lang == pll_current_language()) ? $content : ”;
    }
    add_shortcode(‘polylang’, ‘polylang_shortcode’);

    and the shortcode to be used in the welcome text box and blocks:
    [polylang lang=”en”]My English Text[/polylang][polylang lang=”es”]My Spanish Text[/polylang]
    It probably doesn’t matter whether we use es or sp for Spanish, but it is a good idea to follow international standards.

    #227064

    Towfiq I.

    administrator

    Open up nivo.php and replace this line(appear multiple times):

    <?php echo $arr['re_text_field_id']; ?>

    with this:

    <?php echo do_shortcode($arr['re_text_field_id']); ?>

    and then open up content-blocks.php and replace these lines:

    <?php echo $data['block1_text_id']; ?>
    <?php echo $data['block2_text_id']; ?>
    <?php echo $data['block3_text_id']; ?>
    <?php echo $data['block4_text_id']; ?>

    with these:

    <?php echo do_shortcode($data['block1_text_id']); ?>
    <?php echo do_shortcode($data['block2_text_id']); ?>
    <?php echo do_shortcode($data['block3_text_id']); ?>
    <?php echo do_shortcode($data['block4_text_id']); ?>
    #227351

    Admin Kpasapp

    Thank you.
    Blocks are now bilingual and slides too. I still need to chekc urls. When I replaced all
    <?php echo $arr[‘re_text_field_id’]; ?>
    with
    <?php echo do_shortcode($arr[‘re_text_field_id’]); ?>
    It crashed at first. Then I only replaced
    <h3 class=”entry-title”>href=”<?php echo $arr[‘slide_url’]; ?>”<?php } ?>><?php echo do_shortcode($arr[‘slide_title’]); ?></h3>
    <?php echo do_shortcode($arr[‘slide_description’]); ?>

    Which made title and description multilingual.

    #228086

    Towfiq I.

    administrator

    open up nivo.php and replace:

    <?php echo $arr['slide_url']; ?>

    with this:

    <?php echo do_shortcode($arr['slide_url']); ?>

    #277878

    Joris

    Hi Guys,

    I have tried the 2 solutions offered here and none of them was successful >> Both solutions ended up with an error code.

    Thanks for your help,

    Joris

    #281174

    Towfiq I.

    administrator

    Joris, what are you trying to achieve exactly?

    #281841

    joris

    I would like to be able to translate the blocks and the welcome text of the homepage

    #293094

    Martie

    I would like to be able to translate the blocks and the welcome text of the homepage. I can’t seem to get to them. Can you instruct me as to how?

    #295941

    Towfiq I.

    administrator

    which plugin are you using?

    #297294

    Joris

    Polylang

    #301972

    Towfiq I.

    administrator

    Joris does your content-welcome-text.php contains this:

    <?php echo do_shortcode($asteria['welcm_textarea_id']); ?>

    if it does, you can add this to your welcome text field from the theme options page to translate with polylang.

    [polylang lang="en"]My English Text[/polylang][polylang lang="sp"]My Spanish Text[/polylang]

    #304648

    Joris

    Hi,

    yes it does…

    I copied the line into the welcome text field in the “text” (not the visual) part and it just rendered exactly “as is” on the website… (Sorry I am no specialist).

    Thanks for providing more detailed information,

    Joris

    #309785

    Towfiq I.

    administrator
    #619320

    Robert Barber

    subscriber

    Hi there!

    All information here is really useful Towfqi. Thanks also to Kpasapp for the tip about “sp” and “es”. I’m really happy with my pro version, really recommendable to you all.

    I found some limitations to edit the Call to action with the do_shortcode thing. I only get to make it work in the button but not in the editable text.

    Please Towfqui can you add some light on this? Thank you again.

    <?php global $asteria;?>
    
    <?php $callaction = $asteria['home_sort_id']; if(!empty($callaction['call-to-action'])){ ?>
    <!--Call to Action START-->
        <div class="center">
        <div class="home_action">
        <div class="home_action_left"><?php echo $asteria['call_textarea_id']; ?></div>
        <div class="home_action_right"><div class="home_action_button_wrap"><div class="home_action_button"><a <?php if (!empty ($asteria['call_url_id'])) { ?>href="<?php echo do_shortcode($asteria['call_url_id']); ?>"<?php } ?>><?php echo do_shortcode($asteria['call_text_id']); ?></a></div></div></div>
        </div>
        </div>
        <!--Call to Action END-->
    
    <?php } ?>
Reply To: Tranlsation of Frontpage