Try the following. This is given that the original page url has a .html
in it (contact.html
and info.html
)
<li><a href="https://wordpress.stackexchange.com/questions/87146/<?php
if (false !== strpos(strtolower($_SERVER["REQUEST_URI']), '.html')) {
$uri = str_replace('.html', '-ar.html', strtolower($_SERVER['REQUEST_URI']));
} else {
$uri = '';
}
echo home_url($uri);
?>">arabic</a></li>