WordPress.org

Forums

Assign a theme by screen size or URL? (3 posts)

  1. BadgerBlogger
    Member
    Posted 9 years ago #

    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

  2. Kafkaesqui

    Posted 9 years ago #

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

    <?php
    if( empty($_COOKIE["wptheme" . COOKIEHASH]) && preg_match('/MSNTV/', $_SERVER['HTTP_USER_AGENT']) ) {
    wp_redirect('http://your.blog.url/?wptheme=MSNTVThemeName');
    ?>

    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...

  3. Chris_K
    Member
    Posted 9 years ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags