WPML: getting page title in different language

i’m running my web in english and german using the WPML plugin.
my question:
when in english mode – is it possible getting the page_title() but in german?

thanks

2 s
2

Let’s say the original language of your site is english, then when visiting a german post you would return the title of the corresponding english post like that :

// Get the post ID of original post
$original_ID = icl_object_id( $post->ID, 'post', false, 'en' );

// Get original post title
$original_title = get_the_title( $original_ID );

Hope that helps, in any case check out the documentation for icl_object_id();

Leave a Comment