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:
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?

, , Lisa 3 years 2019-10-21T21:27:00-05:00 0 Answers 83 views 0

Leave an answer