WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a button at the top of the website in header.php. That button should transfer me to the Arabic version of the page if I am on an English page.

For example, on contact.html the button should transfer me to contact-ar.html and on info.html the button should transfer me to info-ar.html.

<li><a href="#">arabic</a></li>

I want to know if there is any way to edit part of the header.php from outside?

share|improve this question
Your question is tagged as wordpress.com which is off-topic on this site. Is it the mistake? – Max Yudin Feb 16 '13 at 7:47
no i am creating my website by using wordpress – sarah Feb 16 '13 at 8:49

Try the following. This is given that the original page url has a .html in it (contact.html and info.html)

<li><a href="<?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);
share|improve this answer
i didn't understand and i think you miss understood me i want for example contact-eng.html includes a button that is added in the header part by the header.php when i click this button it goes to page contact-ar.html – sarah Feb 16 '13 at 11:23
@sarah you mean you want that link to be automatically added to header.php file without you editing that file? – Ahmad M Feb 16 '13 at 12:37
yes i don't want to edit the file i want to make for each page a link that tansfer to arabic page – sarah Feb 17 '13 at 5:52
@sarah That might not be an easy task to accomplish, the important question is where do you want that link to appear? Do you want to append it to a WP navigation menu? Or it is part of WP categories or pages list? Please edit your question posting some more details. – Ahmad M Feb 17 '13 at 6:19
i edited the question but couldn't attach image – sarah Feb 18 '13 at 8:11

The button might not be the best route to solve this problem. If your aim is to have a separate page for each language then look into using the WordPress ML plugin. This will give you the tools (and buttons) to properly have your site be in two languages.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.