1

I would like to capture the lang variable and then translate the page based on this variable.

global $jwp_lang;
$url = $_SERVER["REQUEST_URI"];
echo $url;

for example if the url contains http://localhost/about/?lang=fr I would like to capture this value.

mruss24
  • 367
  • 2
  • 6
  • 14

2 Answers2

1

You can easily capture the value of lang variable using php Super Global variable $_GET :

$lang = $_GET['lang'];
echo $lang;
Sanchit Gupta
  • 3,148
  • 2
  • 28
  • 36
0

It is better to pass the URL parameters using add_query_var, and get the parameter using get_query_var.

Because, they can handdle the set, and get of multiple parameters, and is the recommended way of getting URL passed as parameters.

StevenV
  • 106
  • 2
  • 9