Dynamic Banner Text based on Subdomain
I’m working on a site where each agent has their own subdomain. Each subdomain directs to the content on the main page, there is no difference in content. The only difference requested is a banner that changes based on the subdomain used. For example:
bob..com
Would direct to .com with a banner at the top that says “Welcome to Agent Bob’s Portal!”
I’m not very experienced with WordPress, but what I was aiming for was something like:
<?php $url = $_SERVER["REQUEST_URI"];
if (strpos($url, "bob.")) {
print "Welcome to Agent Bob's Portal!";
}
} ?>
The problem is that I’m not quite sure where to put it. I’ve tried putting it in the page.php file, surrounded by a div that encapsulates the area I want the text in, but that doesn’t seem to work. Is there something else you would recommend trying?
Leave an answer