If else – how to switch between two php files depending on the url

So, I would like to switch between 2 php files depending on the url. So far my code looks like this…

        <?php $url = $_SERVER["REQUEST_URI"];
    if (strpos($url, "/ru/"))  {
       <?php wp_nav_menu(array('theme_location' => 'Tours-en')); ?>
    }else {
       <?php wp_nav_menu(array('theme_location' => 'Tours-ru')); ?>            
    }  
    ?> 

I don’t know what should be before <?php wp_nav_menu(array('theme_location' => 'Tours-en')); ?> like use <? php wp_nav_menu etc.. I hope you see what is my problem. I don’t know the name of the “command” which should be before <?php.

Read More

To clarify, the two php files between which I would like to switch contain menus.

Any help would be appreciated.

Related posts

Leave a Reply

1 comment

  1. What about this:

    <?php 
        $url = $_SERVER["REQUEST_URI"];
        wp_nav_menu(array(
                  'theme_location' => (strpos($url, "/ru/"))?'Tours-en':'Tours-ru'
                          ));
    ?>