I'm working on a multi language website. The default language is dutch and the other two languages are english and french.
There is a button on my homepage which has to go to the page "Features". The slug in the default language is "kenmerken", in english it's "features" and in french it is "fonctionnalites".
My url structure is this: Default language (dutch) carflow.test carflow.test/kenmerken/
English carflow.test/en carflow.test/en/features
French carflow.test/fr carflow.test/fr/fonctionnalites
I already have this code to link to a "kenmerken" page (dutch):
<a class="button button--primary" href="<?php echo get_permalink( get_page_by_path( 'kenmerken' ) )?>"><?php _e('Kenmerken cta','carflow-theme'); ?></a>
How am I able to make this link work for all languages? I can probably do this with a if else statement and check the current language. But that doesn't feel the right way.
Okay I've been testing this out and it seems that Wordpress automatically recognizes the pages.
I'm using the lastest Wordpress version and WPML as translation plugin.
So If I'm on my default language website (dutch) and use <?php echo get_permalink( get_page_by_path( 'features' ) )?>
it goes to the dutch features page despite the fact that features is the english slug for the page "kenmerken".
I think I will be the easiest if I use the english slugs in my code.