WPML – override the “page_for_posts” archive

mgibbs189

{{gist file=”functions.php” lang=”php”}}
<?php

/**
* Within Settings > Reading, the “Posts page” is set to the ENGLISH “Publications” page ID.
* When viewing in French, force the “page_for_posts” option to use the FRENCH page ID.
*/
add_filter( ‘option_page_for_posts’, function( $value ) {
if ( defined( ‘ICL_LANGUAGE_CODE’ ) && ‘fr’ == ICL_LANGUAGE_CODE ) {
$value = 544; // the french “Publications” page ID
}
return $value;
});

{{/gist}}