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 (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


    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?



    Towfiq I.


    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]


    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:
    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.


    Towfiq I.


    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']); ?>

    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’]; ?>
    <?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.


    Towfiq I.


    open up nivo.php and replace:

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

    with this:

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



    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,



    Towfiq I.


    Joris, what are you trying to achieve exactly?



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



    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?


    Towfiq I.


    which plugin are you using?





    Towfiq I.


    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]




    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,



    Towfiq I.


    Robert Barber


    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>
        <!--Call to Action END-->
    <?php } ?>
Reply To: Tranlsation of Frontpage