I am trying to create a multilanguage website. And I have set my home page to a static page in my WP admin area.
This home page ID is 2 and it calls front-page.php
template when I am on the home page at this address, for example, http://examplesite.com/
So for a french version, I have added a new rewrite rule so I have this url, http://examplesite.com/fr/
, and its call the same home page which is ID 2.
add_rewrite_rule(
'^fr/?$',
'index.php?&p=2&lang=fr',
'top'
)
But why it calls index.php
template instead but not front-page.php
?
How can I make http://examplesite.com/fr/
to call front-page.php
?
index.php
file would eventually load yourfront-page.php
file, if the request was your site's home/front page - or the static Page in your case.front-page.php
just as I explained above already.front-page.php
template. You've got a theme or plugin that is somehow changing some fundamental parts of the query/template process, first step is to figure out if it's your theme or what plugin is doing this.index.php
" as in the rewrite rule there. Try changing the?&p=2
to?page_id=2
?