This thread is resolved. Here is a description of the problem and solution.
Problem:
The client wants to display an announcement bar only on the English version of their website using WPML and the Blocksy theme.
Solution:
We recommend creating the announcement bar block and assigning it a specific CSS class. Then, use CSS to hide this block from other languages. Here's a step-by-step guide:
1. Create the announcement bar in your Blocksy theme and assign a unique CSS class to it.
2. Use the following CSS rule to hide the block from other languages, replacing '
.your-css-class
' with the class you assigned:
.html:not(:lang(en)) .your-css-class { display: none; }
This CSS rule ensures that the announcement bar is only visible on the English version of your site.
For more details on CSS targeting based on language, you can refer to this Stack Overflow discussion: https://stackoverflow.com/questions/8916360/whats-the-difference-between-htmllang-en-and-htmllangen-in-css
If this solution does not apply to your case, or if it seems outdated, 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. If further assistance is needed, please open a new support ticket 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 1 reply, has 2 voices.
Last updated by 10 months, 2 weeks ago.
Assisted by: Mihai Apetrei.