Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing issues with styles not working when your site is translated into another language, such as Swedish, and encountering invisible text in the banner section, the problem might be related to the theme files. Specifically, conditions in the

header.php

file might be set to show content only on pages with a specific ID, which does not account for translated pages having different IDs.
Solution:
We recommend checking your theme's

header.php

file for conditions that limit content display based on page IDs. You should modify these conditions to accommodate the dynamic nature of page IDs in multilingual setups. Here's an example of how you can adjust the code:

is_page( apply_filters( 'wpml_object_id', 7, 'page', true, apply_filters( 'wpml_current_language', null ) ) )

This adjustment ensures that the correct page ID is used for the current language, allowing styles and text to appear as expected.

If this solution does not resolve your issue, or if it seems outdated or irrelevant to your case, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. Additionally, if you need further assistance, please do not hesitate to open a new support ticket with us at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

This topic contains 10 replies, has 0 voices.

Last updated by Shekhar Bhandari 1 week, 4 days ago.

Assisted by: Shekhar Bhandari.

Author Posts
August 8, 2025 at 8:19 am #17304612

maciej-motlawskiI

Background of the issue:
I am trying to get working styles when the site is translated to Swedish. In the primary language (Polish), everything looks fine. The issue can be seen on this page: hidden link.

Symptoms:
Some elements are translated, but styles are not working. The text on the top of the site, in the banner section, is invisible in languages other than the primary one. I expected to see working styles with translation and visible text on the top of the section (banner). Instead, I got invisible text, images, and not working styles.

Questions:
Why are styles not working when the site is translated to Swedish?
Why is the text in the banner section invisible in languages other than Polish?

August 11, 2025 at 6:57 am #17308192

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Thank you for contacting WPML support. I'd be happy to assist you on this issue.

Can you make a small change on the original language, like adding a text and update the translations to see if it helps?

If that doesn't help, To debug this issue further, I would need to check your site settings once, for this I would need temporary access (wp-admin and ftp) to your site.

So could you please provide me with those details, you will find the needed fields for this below the comment area when you log in to leave your next reply.
hidden link

This info is private and available to you and WPML supporters only.
Read more about this: https://wpml.org/purchase/support-policy/privacy-and-security-when-providing-debug-information-for-support/

Note:
Backup your sites before providing the credentials or if possible provide credentials for the test site

Look forward to your reply.

Thanks

August 11, 2025 at 8:15 am #17308329

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

I went to WPML->Settings->Post Type Translations and set the following post types to not translatable "Field Groups (acf-field-group)"

Then I went to the field groups and set translations preferences to same fields across languages for all fields for homepages.

Can you set the translations preferences for all fields accordingly?

Also, I see you are editing pages manually, instead of using WPML editors, I would recommend you to use WPML editors.

Can you try the suggestions and see if it helps.

Thanks

August 11, 2025 at 8:28 am #17308343

maciej-motlawskiI

Still doesnt work, screeens attached with all problems.

Zrzut ekranu 2025-08-11 102825.png
Zrzut ekranu 2025-08-11 102540.png
Zrzut ekranu 2025-08-11 102526.png
Zrzut ekranu 2025-08-11 102330.png
Zrzut ekranu 2025-08-11 102308.png
August 11, 2025 at 8:49 am #17308514

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

The issue is your theme files header.php where you have set the conditions to show on page with ID 7, the translated page will have a different id.

hidden link

is_page( apply_filters( 'wpml_object_id', 7, 'page', true, apply_filters( 'wpml_current_language', null ) ) )

I modified it accordingly and it seems to be working for me, please check and let me know if this helps.

Thanks

August 11, 2025 at 8:53 am #17308523

maciej-motlawskiI

Thanks!
It seems to work for me also. The last problem and question is with style/css. Screen attached for example section.

obraz_2025-08-11_105302645.png
August 11, 2025 at 9:01 am #17308551

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

This is also due to same issue as I mentioned ahead, on functions text_with_c_pill() you are using page ids and it's affecting the content, please adjust it accordingly.

Thanks

August 11, 2025 at 9:51 am #17308952

maciej-motlawskiI

So i need to change the code here:

<?php
/**
* Renders a text component with a "C" shape on one side.
*
* @param string $side 'left' or 'right' (default: 'right') - side where the text appears
* @param string $heading Heading text to display
* @param string $subtext Subtext to display below heading
* @param string $c_image Path to C-shaped image (relative to theme, default: 'assets/big_c.svg')
* @param string $text_color Text color class (default: 'text-white')
*/
if (!function_exists('text_with_c_pill')) {
function text_with_c_pill($side = 'right', $heading = 'DOŚWIADCZENIE', $subtext = 'Lata praktyki w międzynarodowej administracji.', $c_image = 'assets/big_c.svg', $text_color = 'text-white')
{
// Dodaj CSS tylko raz
static $css_added = false;
if (!$css_added) {
echo '<style>
/* Pierwszy breakpoint: 768px do 1280px */
@media (min-width: 768px) and (max-width: 1280px) {
.c-size-md {
width: 60% !important;
}
}

/* Drugi breakpoint: 1440px do 1536px (96rem) */
@media (min-width: 1440px) and (max-width: 1535px) {
.c-size-xl {
width: 80% !important;
}
}
</style>';
$css_added = true;
}

// IMPORTANT: The 'side' parameter specifies where the TEXT appears, not the C shape
// C shape should be on the opposite side from the text
if (is_page(49)):
$c_position = ($side === 'left') ? '2xl:-right-10 md:-right-25 -right-25 -top-5 2xl:-top-10 md:top-0' : '-top-5 md:left-0 2xl:-left-10 2xl:-top-10 md:top-0';
$text_alignment = ($side === 'left') ? 'text-left md:pr-16 pr-35' : 'text-left md:pl-16 pl-10';
$text_spaceing = ($side === 'left') ? '2xl:pl-12 md:pl-35 md:mr-[15vw] 2xl:mr-0 md:pr-[2vw] mt-[8rem]' : '2xl:pr-12 md:pr-35 md:ml-[15vw] 2xl:ml-0 mt-[8rem]';
$sizes = 'h-full 2xl:w-auto w-[20vw] md:w-2/3 c-size-md c-size-xl object-cover ';
elseif (is_page(7)):
$c_position = ($side === 'left') ? '2xl:-right-10 md:-right-25 -right-55 -top-12 2xl:-top-10 md:top-0' : '-top-12 -left-10 2xl:-left-10 2xl:-top-10 md:top-0';
$text_alignment = ($side === 'left') ? 'text-left md:pr-38 2xl:pr-16 pr-35 ' : 'text-left md:pl-16 pl-2 md:pr-0 pr-35';
$text_spaceing = ($side === 'left') ? '2xl:pl-0 md:pl-[5rem]' : '2xl:pr-0 md:pr-20';
$sizes = 'h-full 2xl:w-auto w-1/2 2xl:w-2/3 c-size-md c-size-xl object-cover';
endif;

// Get the theme URI for image paths
$theme_uri = get_template_directory_uri();

echo '
<div class="2xl:h-[10vh]"></div>
<div class="pill_c_con ' . $text_spaceing . ' relative rounded-full my-4 mt-[8rem]">
<div class="pill_c_div relative z-20 ' . $text_color . ' flex flex-col justify-center h-full py-6 md:mt-0 md:w-auto w-[100vw] ">
<h2 class="h2pill ' . $text_alignment . ' tracking-[0.1em] text-[2.3vh] md:text-[1.46vw] font-bold mb-2 libre-baskerville-regular uppercase">' . $heading . '</h2>
<p class="text_c_p ' . $text_alignment . ' text-[2.3vw] md:text-[1.05vw] inter-regular">' . esc_html($subtext) . '</p>
</div>
<div class="pill_c_img absolute ' . $c_position . ' md:-top-10 z-10">
<img src="' . $theme_uri . '/' . $c_image . '" alt="" class="' . $sizes . '">
</div>
</div>
';
}
}
?>

and replace the elseif (is_page(7)): with the example u send to me ---->

is_page( apply_filters( 'wpml_object_id', 7, 'page', true, apply_filters( 'wpml_current_language', null ) ) )

August 11, 2025 at 9:52 am #17308955

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Yes, for every id declaration use the code as used earlier:

More details: https://wpml.org/wpml-hook/wpml_object_id/

August 12, 2025 at 7:25 am #17312186

maciej-motlawskiI

Hi

I made the changes we were talking about. The last problem is with the site "projekty". I dont see the elements to translate. They are not even visible.

I uploaded the changes to new site:
hidden link

user and password are the same as previous.

August 12, 2025 at 7:27 am #17312189

Shekhar Bhandari
WPML Supporter since 03/2015

Languages: English (English )

Timezone: Asia/Kathmandu (GMT+05:45)

Hello there,

Every ticket is reserved for resolving one specific matter, ensuring focused support, streamlined communication, and high-quality service. Therefore, please open new tickets for your other concerns.

Thanks