0

Can I add a button on the menu bar that take the user to another website with the same current path?

For example, I am in the page with url:

www.example.com/test/blank

And when press the button it takes me to the url:

www.example.com **/ar** /test/blank
0

This can be achieved using WordPress Multisite Network.

See this tutorial for same:

http://www.wpbeginner.com/wp-tutorials/how-to-install-and-setup-wordpress-multisite-network/

Also, if you don't want multisite, for some reason, you can create a sub-folder in WordPress root of existing and install a separate WordPress in it.

  • I have already installed another WordPress in a sub-folder, but I want the button take me to the other WordPress with the same path (/test/blank in the example above) not to the home page. Is that possible without using WordPress Multisite Network? – AlHasan Jan 31 '17 at 13:12
  • Have you tried giving the complete link? As in www.example.com/ar/test/blank? And make sure link exist. – Aniruddha Gawade Jan 31 '17 at 13:19
  • Yes, this work for only one page. I am sorry for not being very specific. But what I actually need is changing the path according to the current page path. So if I am on the page: (www.example.com/test/blank) it will take me to (www.example.com /ar /test/blank), and if I am on (www.example.com/another/test) it will take me to (www.example.com /ar /another/test) – AlHasan Jan 31 '17 at 13:25
0

You could do something like this:

$cur_url = get_permalink();
$new_url = str_replace('example.com','example.com/ar',$cur_url);

echo "<a href='".$new_url."'>Link</a>";
  • Thank you. Can I use this with a link in a menu? – AlHasan Jan 31 '17 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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