Background of the issue:
I am trying to ensure that the 'Office' CPT on hidden link remains in English even when a user switches to French. I changed the CPT to 'Not translatable,' but this caused issues. I can replicate the problem on the dev site and provide credentials for viewing.
Symptoms:
The language switcher breaks on the office archive page, and I still see French content within the office CPTs, regardless of the selected language.
Questions:
Why does setting the 'Office' CPT to 'Not translatable' break the language switcher?
How can I ensure that the 'Office' CPT displays only in English, regardless of the selected language?
The office's text is in English, but the rest of the page is in French. This is expected.
Did you manage to fix it? If not, can you please elaborate?
In any case, I enabled a private reply so you can share credentials if needed.
Maybe I'll need to replicate your site locally. For this, I'll need to temporarily install a plugin called “Duplicator” or "All in One WP Migration" on your site.
This will allow me to create a copy of your site and your content.
Once the problem is resolved, I will delete the local site.
**IMPORTANT**
- Please make a backup of site files and database before providing us access.
- If you do not see the wp-admin/FTP fields this means your post & website login details will be made PUBLIC. DO NOT post your website details unless you see the required wp-admin/FTP fields.
It looks like you are using a custom theme. Please note that we are currently not able to provide support for custom work within this forum.
I will, however, try to point you in the correct direction.
The file:
wp-content/themes/salas/header.php
includes a switcher in the tertiary menu. If the office CPT is not translatable, the switcher breaks. I can't dig deeper into why that happens.
I suggest skipping the switcher in that case, like this:
replace line 70
Thanks. Unfortunately, that code did remove the broken menu from the Offices page, it also removed the language switcher from all pages (example: hidden link). Maybe that's because the language switcher isn't in the Tertiary Navigation menu; it's in the Languages Navigation menu.
I tried to adapt your code to include the Languages Navigation rather than the Tertiary Navigation, but that removed the language switcher from all pages, and didn't fix the broken nav menu on the Offices page.
Also, some offices are still showing French content on the US page: hidden link (note "ÉTATS-UNIS" rather than "UNITED STATES"). So that's still a problem unrelated to the language switcher.
Some offices are still showing French content on the US page: hidden link (note "ÉTATS-UNIS" rather than "UNITED STATES"). So that's still a problem unrelated to the language switcher.
This expected.
Probably those offices appear twice, once in French and once in English. Your site already has offices in both languages, there are office posts that have already been translated. When you make the CPT untranslatable, all the content remains.
What you can do is the following:
❌ Please make a full website backup before proceeding ❌
- Make the CPT translatable
- In the WP dashboard, go to Offices
- Switch to French using the language switcher in the admin bar
- Trash all the translated office posts
- Empty the Trash
- Set the CPT untranslatable again
Thanks! That fixed the offices showing in French on US pages. Are you able to help any more with the navigation menu problem, or not, because it's a custom theme?
If you have any specific questions, I'll be happy to help. But I can't debug the custom theme. I am sorry, it's outside our support scope and probably outside of my knowledge :).