Moesia missing hook with Polylang

Awesome theme Moesia btw, and I pretty much used Polylang which is mentioned in “Sydney” theme to create a language switcher.

However, the header image part, the way it explained in “Sydney” theme documentation isnt working on “Moesia” theme, “Moesia” theme can not recorgnize or record any string from header area title, any solution ?

Hello there,

In Moesia, the strings value of the customizer controls isn’t fully translatable because it hasn’t been supported by theme’s core yet. I am still looking into the solution. I will update you ASAP. Please be patient.

Regards,
Kharis

Hello there,

To register the header area title into the Polylang’s strings translation, we must add a pll_register_string function and modify the respective customizer control output in the header.php file. You must pass it in a child theme mode.

  1. In your child theme’s functions.php file, add the following line:
if (function_exists('pll_register_string')) {
	pll_register_string('Header title', get_theme_mod('header_title'), 'moesia');
}
  1. Copy the header.php file from parent theme to your child theme. Then find the following code:
<?php echo esc_attr(get_theme_mod('header_title')); ?>
  1. Change it with the following:
<?php echo esc_html(pll__(get_theme_mod('header_title'))); ?>

Let me know how it goes.

Regards,
Kharis

It works perfect, thank you so much for the help!!I am not very familiar with php but this really helps

BTW, if its not too much trouble, may I have your assistence on 2 more thing thats related ?

  1. can find where to download child theme for Moesia?
  2. can I get a code snippet to add string for the subtitle and button for header area too ?

Hello there,

Thank you for updating me.

> 1. can find where to download child theme for Moesia?

Apologies, we don’t have it yet. You should create it by yourself.

> 2. can I get a code snippet to add string for the subtitle and button for header area too ?

In the theme’s functions.php file, remove the previous code I suggested. Then add he following:

if (function_exists('pll_register_string')) {
	pll_register_string('Header title', get_theme_mod('header_title'), 'moesia');
	pll_register_string('Header description', get_theme_mod('header_desc'), 'moesia');
	pll_register_string('Header button text', get_theme_mod('header_btn_text'), 'moesia');
}

In the header.php file, find the following:

<?php echo esc_html(get_theme_mod('header_desc')); ?>

replace with

<?php echo esc_html(pll__(get_theme_mod('header_desc'))); ?>

then find the following:

<?php echo esc_html(get_theme_mod('header_btn_text')); ?>

replace with

<?php echo esc_html(pll__(get_theme_mod('header_btn_text'))); ?>

Let me know how it goes.

Regards,
Kharis

sorry for the late response, been out of town, I tried above and wow it works great, and I appreciate your effort in helping me

Hello there,

Thank you for updating me. I am glad to hear that.

I am marking this thread as resolved. Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis