Forgive me if someone asked this, but I didn't see anything like this in the comments. I want a tab on the navbar to randomly link to one of a couple dozen websites. I found code to do this with javascript or with php, and the code works fine, but I can't figure out how to incorporate it into the code for the tab.
Here's one of the codes I found for making a random link:
PHP Code:
$links = array("link 1", "link 2", "link 3");
$max = sizeof($links);
$rand = rand(0, $max);
echo ("<a href = \"$links[$rand]\">Click Here for a Random Link</a>");
I've tried to just insert something after href=, like $links[$rand], or echo($links[$rand]), or print($links[$rand]), into the last line of the code for the plugin but then the navbar link just takes me to www.mywebsite.com/$links[$rand].
PHP Code:
<a class="navtab" href=$links[$rand]>Nav Link</a>'.$tablinks.'</li>' ;
I've considered using the random number generator to send it to a bunch of if statements with each one having the last line from your code but with a different url, but I was worried that having dozens of if statements get evaluated every time someone loads a page on my site might slow it down or be bad for it or something.