[Resolved] Translated taxonomy not showing correct template
This thread is resolved. Here is a description of the problem and solution.
Problem: You are unable to display the FSE template for one specific taxonomy term in the secondary language on your site, while other terms display their templates correctly. Solution: We corrected a mistake in the function we initially shared with you. Here is the updated function that you should use:
Please replace the previous code with this corrected version. Additionally, we noticed that the term-specific template might not be added correctly from the backend. Could you please inform us about the tools or methods you are using to add the term template?
If this solution does not resolve your issue or seems irrelevant due to being outdated or not applicable 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. 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.
I wanted to check the issue, but now it seems OK. And, now, I'm checking the French page. The slug is translated, and the layout is not broken and is the same as in English. Please see the attached screenshot.
I wouldn't say it's fixed necessarily, I just ended up adding a custom block that looped through the term and displayed those posts, depending on which term page you were on.
There still is an issue where WPML isn't able to properly translate the FSE template I created for the specific taxonomy term, berry. The shrubs and flower term templates are working in French, but not the berry template. Very strange. It would be good to resolve this.
I compared the English and French pages, which looked the same. This is why I assumed that the issue was fixed. I didn't know that you changed the template or how.
Let me please summarize this case. You presented a particular problem. We debugged it and recognized the source of the problem from WPML's side. We provided two workarounds and escalated the issue to our developers. You said the first workaround worked for you but is less preferable. You said that the second workaround is not working for you. We have two options until our developers will address this issue and fix it in future versions of WPML.
A. You apply the first (less preferable) workaround.
B. You will recreate the issue on your site so we can check why the function we provided is not working on your site. I'll then be able to present it to our second-tier supporter.
I've now re-created the issue that I was experiencing before. You'll see I've created a new template for the berry species, and have added a line directly before the list of berries that says 'This is the berry template' on the English version, but it's not being rendered on the French version, even though the French version of the template exists in the template area. What I think it's doing is inheriting the Species taxonomy template, and not the more specific berry term template, for French.
Thanks for recreating the issue. I can now see that the text you added is not on the translated French page. I also tried things myself. I added the function directly in the functions.php and did not include it in a separate file as you did it. (It is just to check that there is no problem with the inclusion.) I then retranslated the page, but it didn't solve the problem. I've shared this information with our second-tier supporter. When I have his reply on this, I'll share it with you here.
Our second-tier supporter has fixed the issue on your site. Now the correct template is shown in French here.
hidden link
Apparently, there was a mistake in the code we shared with you. The second-tier supporter corrected the function and, as I mentioned, already applied it on your site. For the record, the corrected function is this.
Thanks for the update. I see that things are working now.
I add the term specific template from the FSE area under Appearance > Editor > Templates, then add a new template using the + sign icon, next to Templates heading, and choose Species > Baies (or whatever term is hasn't been assigned a template). Right now, all of the species terms have been assigned a template, so they're not going to show up while following the instructions above.
If you delete a term template for a specific term, it will again show up in the list when following the instructions above. When I was trying to troubleshoot, I decided to simply create a species template that would loop through whatever term I was on, instead of using term-specific templates, as all term templates are going to be using the same components. But, there may be cases in the future where I'd want to have a term-specific template, so it was good to troubleshoot this issue, as it was clearly a bug.
I passed it to our second-tier supporter. The issue is still being escalated to our developers. I'll update you here once I have news about this issue.
Right now, I have no news about this. Let me please remind you that this issue has been escalated to our developers. It has the following description of the problem.
Full Site Editing -> Specific Category template depends on the "post_name" to match the slug of the term.
It is up to our developers to decide when to handle this. We provided you with a workaround, which you confirmed works. I'll update you here once the version with the fix is released.