Skip to:
Content
Pages
Categories
Search
Top
Bottom

Re: Change theme if mobile browser detected.


chrishajer
Participant

@chrishajer

Sounds like you have the mobile browser agent stuff figured out with the Tera-WURFL library. So, when you detect a mobile browser, you want to display your forum using the1col_fixed theme? Looks like it checks for a match to a mobile browser like this:

$matched = $wurflObj->getDeviceCapabilitiesFromAgent($_SERVER['HTTP_USER_AGENT']);

// see if this client is on a wireless device (or if they can't be identified)
if(!$matched || !$wurflObj->getDeviceCapability("is_wireless_device")){
echo "<h2>You should not be here</h2>";
}

 

So, instead of the <h2> message they are displaying, you could use a theme switcher plugin to set the theme and direct someone to that URL. How about something like this:

https://bbpress.org/plugins/topic/bbpress-theme-switcher/

That plugin says it uses cookies to persist the theme choice.

Skip to toolbar