I'm trying to set the language of a wordpress website dynamically.
I'm using following code :
<?php
$lang = 'en';
if(isset($_GET['$lang'])){
$lang = $_GET['$lang'];
}
if($lang=='en'){
include('en.php');
}
else{
include('nl.php');
}
?>
With en.php and nl.php being files in the same folder containing associative arrays with values I'd like to echo through the page.
However, if I upload the en.php file on the server, everything starting from that code is considered null and non existing. I've set a comment right before the code, it's shown in the browser debug tools, but nothing after except the closing tags.
An example of the html :
<section id="welcome" class="container">
<h1 class="menu titreone"><?php echo $dictionary['WELCOME_TITLE'];?></h1>
<p><?php echo $dictionary['WELCOME_TEXT'];?></p>
</section>
(where, obviously, Welcome_title and Welcome_text are part of the array)
Would anyone be kind enough to point my mistake? I'm not really used to php/wordpress, so it might be very simple, but the bad news is that I've no idea what to look after.
Thank you