Multilanguage website get the title, on different languages
I am working on a website, and I am using Polylang to translate it to a different language. In my code I want to get a page title, and display it. My issue is I cannot get it by ID or page_by_path because its going to display the English version of the page on every language.
For example: I want to display the Contact page title on english Contact and on another language its equivalent translated contact page title.
Is there a way to do that?
The code that I'm using so far:
?php $page = get_page_by_path( 'contact' ); ?
span?php echo get_the_title( $page ); ?/span
Topic plugin-polylang get-the-title Wordpress
Category Web