Sorry if this has been asked - I haven't figured out how to search it in a way that leads me where I want to go.
We have a client who wants a site built that represents four geographical areas and so the first URL part after the bare domain should represent that like so: example.com/state-code/
Let's say:
Member A signs up and indicates FL as their home State (using a custom field select dropdown).
Member B signs up and indicates AZ as their home State.
So the site looks like: http://www.example.com/fl/ to User A, and http://www.example.com/az/ to User B.
We want to use the same core for the site, same template files, same database, etc. We just want to be able to make some basic conditional changes in those templates based on location as a geo-relevant site is important to end users but all other functionality doesn't need to be duplicated because it would be redundant. E.g.
/* header.php */
if ($user->location === 'fl') {
echo '<img src="logo-florida.png" />';
} else if ($user->location === 'az') {
echo '<img src="logo-arizona.png" />';
}
// etc.
Should this just be done by assigning a Category or Tag to our Users (and therefore something like %category% in the Permalink) and matching that with the custom field entry? Or is there a way to dynamically prepend the State to the URL depending on the variable contents from the custom State field in the User?
How can we easily and cleanly add a custom value into our URL/permalink structure?