I am attempting to change my menus depending upon the url. I have tried a couple of different things to no avail.
I have tried using php to call to the code on the page, (see the code below, I used this but rather than calling to the include file I was calling to the code itself on the page) and the result was a blank page in the browser.
Then I tried calling to the include files that I created with the menu code in it.
The menu itself, has some PHP in it and I think this may be why it is not working. I tried a simple call to the menu include file and the menu did not print out to the browser.
<?php include("/wp-content/themes/wslh/inc/i_menu-wohl.php"); ?>
It stopped printing out as soon as the menu php started, so when I did a view source there was only this:
<ul id="nav">
<li><a
The php that came after that was:
<?php nav_active( 'about' ); ?> href="/about/">ABOUT<br>WSLH</a>
And the rest of the menu code, which is really long so I will not put it here. The menu itself works fine hard coded on the page when I am not trying to include it for this if then statement:
<?php
$url = $_SERVER["REQUEST_URI"];
if (strpos($url, "/occupational/wohl/") === 0) {
echo '<?php include("/wp-content/themes/wslh/inc/i_menu-wohl.php"); ?>';
} else {
echo '<?php include("/wp-content/themes/wslh/inc/i_menu-wslh.php"); ?>';
}
?>
Can anyone assist me with this? I have created if then else statements using ASP and have never run into this issue. Thank you in advance for your help. Please let me know if you have any questions or I have not given enough info.