• Resolved cucora

    (@cucora)


    Hello,

    thanks for the Kale theme, I like it a lot and enjoy the beautiful style.

    However, I’d like to ask you whether it is possible to set up featured posts in two languages. I am using Polylang plugin. When I set up the featured posts in Slovak language, these same Slovak posts are displayed in English version of the website.

    Is it also possible to set up the “heading of featured posts” and “heading for blog feed” for both languages differently?

    Thank you very much for your help.

    Kind regards,

    Katarina

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • jarektheme

    (@jarektheme)

    Hi Katarina,

    In order to translate texts from Customizer you need to change some theme files.

    1. Open wp-content/themes/kale/functions.php file and add this line before the closing php tag ?>:

    pll_register_string('Featured Posts', kale_get_option('kale_frontpage_featured_posts_heading'), true);
    pll_register_string('Recent Posts', kale_get_option('kale_blog_feed_label'), true);

    2. Then go to line 264 and replace this line:

    $title = esc_html($title);

    with this:

    $title = pll__(esc_html($title));

    3. Do the same inside wp-content/themes/kale/parts/frontpage-featured.php file and replace this line:

    <h2 class="block-title"><span><?php echo esc_html($kale_frontpage_featured_posts_heading); ?></span></h2>

    with this:

    <h2 class="block-title"><span><?php echo pll__(esc_html($kale_frontpage_featured_posts_heading)); ?></span></h2>

    4. Finally please go to Languges → String translations and you should see new strings which you can translate as you wish.

    Please note also that you will lose all modifications after next theme update so the best way to add these changes would be creating Child Theme and add these modifications there.

    Hope that helps.

    Kind regards

    • This reply was modified 7 years ago by jarektheme.
    Thread Starter cucora

    (@cucora)

    Thank you very much for your help with headings.

    Could you please advise me also on the featured posts? Is it possible to set up featured posts for both languages? There is only Slovak version of the featured posts (three recipes – Boeuf bourguignon, Lieskovo-orie?ková roláda s malinami, Kokosové mlieko), even when I switch to English.

    Thank you,

    Katarina

    jarektheme

    (@jarektheme)

    Hi Katarina,

    I’m not a Polylang expert but I’ve looked through all Polylang documentation and found only this:

    $posts = get_posts( array(
        'post_type' => 'post',
        'lang' => 'fr', // use language slug in the query
        'showposts' => 5,
    ) );

    This method allows you to get posts in specified language, however I couldn’t find any function which allows you to get specified post as it is in Featured Posts section.

    Please ask in Polylang support forum if they provide any function for getting particular post: https://www.ads-software.com/support/plugin/polylang

    Kind regards

    • This reply was modified 7 years ago by jarektheme.
    Thread Starter cucora

    (@cucora)

    Thanks a lot for your support and efforts.

    As you suggested I am going to ask in Polylang support forum.

    Kind regards,
    Katarina

    jarektheme

    (@jarektheme)

    Hello Katarina,

    Thank you for your time.

    Please let me know if there is ever anything else I can assist with.

    If you ever have two minutes spare, please consider reviewing our theme on https://www.ads-software.com/support/theme/kale/reviews/#new-post
    We’d really appreciate it ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to make multilingual featured posts using Polylang and Kale theme’ is closed to new replies.