WP Hive » Troubleshooting and How-To

How to use subdomain for template conditional logic?

(2 posts)

No tags yet.


  1. mark
    Member

    I want to add a little conditional logic to vary the header of the theme according to the subdomain. Is there a neat way of getting the current subdomain?

    Posted 3 years ago #
  2. wwday3
    Member

    get_bloginfo('url') will get the site's url. It should show up as 'http://sub.domain.com'. You're code might look something like

    ?php
    $url = get_bloginfo('url');
    if ($url == 'something' {
    do something
    } else {
    do something else
    }
    ?>

    (I left the first '<' off since I have no idea if the forum would try to parse PHP or not :)

    Posted 3 years ago #

RSS feed for this topic

Reply

You must log in to post.