Closed yoavf closed 9 years ago
This fixes the issue as I described in #193, but I have no idea how it would affect other use cases. Edit: actually, in only fixes the front page template for the default language. The translated language will load the default template.
To make sure front-page.php
loads for the translated front page as well, is_front_page()
will need to return true. A hack-ish way of doing that is by filtering the page_on_front
option, after we've fetched the translated page id for rewriting the query var. Something like:
if ( 'page' == get_option('show_on_front') && $page_on_front = get_option('page_on_front') ) {
// @TODO: Get translated page ID
unset( $query_vars['pagename']);
$translated_page = $this->get_post_in_lang( $page_on_front, bbl_get_current_lang_code() )->ID;
add_filter( 'pre_option_page_on_front', function( $value ) use ( $translated_page ) {
return $translated_page;
} );
$query_vars[ 'page_id' ] = $translated_page;
$query_vars[ 'post_type' ] = $this->get_post_type_in_lang( 'page', bbl_get_current_lang_code() );
return $query_vars;
}
Closed in favour of #309
See #193