Перейти к содержанию Перейти к боковой панели

Помечено: 

Эта тема содержит 0 ответ, имеет 0 голоса.

Последнее обновление: janv-21 7 месяцев назад.

При содействии: Laura.

Автор Посты
14 января, 2025 в 8:48 дп #16591741

janv-21

Background of the issue:
We are trying to find a way to change the URLs that are displayed when using the language switcher. Our setup currently is a little out-of-the-box where we are using one page to display multiple different results depending on a specific query var. Our setup is as follows: We have a detail page, let's say "/details". This page contains the base layout but doesn't display any data when directly accessed. When you directly visit "/details" we'll show a 404 message. We have a redirect rule to provide the query var. This ends up looking like "/details/123-item-title". This will redirect to "/details?item_id=123". Whenever accessing "/details/123-item-title" the detail page will retrieve data from an external API, cache it, then show it. In other words, WordPress is not aware of the item's details.

Symptoms:
We can't seem to find a way to hook into the language switcher to define a custom URL for the "/detail" page. We are not able to use WPML's default post slug translation feature as there are no posts to translate.

Questions:
Is there any way to hook into WPML to customize the URLs that the language switcher produces?
Can we use the base WPML functionality to ensure the references all align, especially the language switchers and alternate hreflangs?