Ce sujet est résolu. Voici une description du problème et de la solution.
Problem:
The client is experiencing issues with hard-coded links in their PHP WordPress files, resulting in incorrect URLs with a double-slash in the English version of their site.
The code uses looks like this:
<?php echo home_url();?>/page-slug/">
Solution:
home_url() will return the home url without a trailing slash.
Here we can offer different solutions:
1. Use home_url( '/' ) to force the inclusion of a trailing slash, and then remove the initial slash from all links.
Example:
<?php echo home_url( '/' );?>page-slug/">
For reference, see the WordPress home_url function documentation.
2. Utilize the
wpml_home_url
hook
For more information, check out the wpml_home_url hook documentation.
3. Replace the hard-coded links with a WordPress menu that can be translated and synchronized using WPML.
You can find guidance on this process in the Translating Menus documentation.
If this solution does not seem relevant to your situation, please do not hesitate to open a new support ticket with us for further assistance. You can do so by visiting the WPML support forum.
Il s'agit du forum d'assistance technique de WPML, le plug-in multilingue pour WordPress.
Il est accessible à tous, toutefois seuls les clients de WPML peuvent y publier leurs messages. L'équipe du WPML répond sur le forum 6 jours par semaine, 22 heures par jour.
Ce sujet contient 1 réponse, a 2 voix.
Dernière mise à jour par Il y a 1 année et 4 mois.
Assisté par: Nicolas V..