Support » Fixing WordPress » Assign a theme by screen size or URL?

  • Is there a way to assign a user a theme by using a browser sniffer to check their screen size or possibly by giving them a specific URL?

    The reason I ask is because I have a few friends on MSNTV, so their screen size is fixed at 560 pixels wide. I would like to have a theme that they can use, but they can’t seem to get to my “theme chooser” to select one of the narrow themes.

    I think once they get to the desired theme, it will save for them and when they come back, the proper theme will load.

    BTW, I am using 1.5

Viewing 2 replies - 1 through 2 (of 2 total)
  • The only thing I can imagine which *may* work is to stick a bit of code such as the following at the top of your *main* theme’s template (i.e. header.php):

    if( empty($_COOKIE["wptheme" . COOKIEHASH]) && preg_match('/MSNTV/', $_SERVER['HTTP_USER_AGENT']) ) {

    This assumes that A. cookies are cookies are cookies, B. The user agent for MSNTV has “MSNTV” as part of the value, C. You’re using Ryan Boren’s ThemeSwitcher plugin, and D. a few other miscellaneous things. I can’t really test it…

    Not sure I have a direct answer… however… there probably is a way since Alex King figured out a way to do something like that with his WordPress Mobile Edition plugin. Maybe grab that and have a look?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Assign a theme by screen size or URL?’ is closed to new replies.