Home Forums Weaver Xtreme Theme Firefox User Agent Switcher and Xtreme

Viewing 14 posts - 1 through 14 (of 14 total)
  • Author
  • #17512

    I am working on converting a site from Weaver II to Xtreme, and have it pretty well done except mobile device testing. With Weaver II, I use Firefox desktop browser with user agent switcher plugin to test the site for lots of different devices and browsers, and it works fine. But with Xtreme, it is not recognizing any of the user agents or devices I set in the user agent switcher. It always renders the desktop version. I still have both themes installed, and can switch back & forth between the two, changing nothing else, and the problem is only with Xtreme. On actual mobile devices, it seems to work, to some extent, with exception of the following:

    I use php code in a plugin to generate different content and layouts for desktop vs certain mobile devices. I set a global variable with:

    if (function_exists(‘weaverii_use_mobile’)) {
        if (weaverii_use_mobile(‘phone’)) $uidx_is_mobilephone = true;
        if (weaverii_use_mobile(‘smalltablet’)) $uidx_is_smalltablet = true;

    And that doesn’t seem to be working in Weaverx as it does in Weaver II. Looking at code in the Weaverx Theme Support plugin that does something similar, I don’t see any differences in the function or variable names. The name of the function doesn’t seem to have changed, and the parameters are the same. It just doesn’t work.


    I’ve struggled with the opposite last few months, and just a few hours ago understood where was the error 🙂 my Weaver Xtreme produced five different cache versions due to remnant saltshaker .php file. But that feature was designed for Weaver II Smart Mode.
    Why would you expect any change in Xtreme when all versions are in fact identical. The great advantage of Weaver Xtreme is using the responsive feature, so less time cache preloading, decreasing server load.


    Normal responsive behavior, even with the various responsive classes and css, is not adequate for what I need to do. The content my plugins generate is not as simple as 1 or 2 or 3 column choices. They are very complex layouts. Plus I have to pass special device specific parameters to 3rd party plugins and in off-site http API requests that actually generate mobile specific content and layouts that I have no control over.


    Big part of the issue: if ( function_exists(‘weaverii_use_mobile’) ) always returns false. The function does not exist. Weaver Xtreme is the active theme and Weaver Xtreme Theme Support plugin is active. So what happened to the weaverii_use_mobile function?

    If this function doesn’t exist, then how would the vimeo shortcode in Weaver Xtreme Theme Support ever work for mobile devices? It probably doesn’t. See lines 437-438 in Weaver Xtreme Theme Support:

        if (function_exists(‘weaverii_use_mobile’))
            if (weaverii_use_mobile(‘mobile’)) $percent = 100;

    [show_if] and [hide_if] can’t do what I need to do, so an answer that references these shortcodes is not what I am looking for.


    Also installed a user agent switcher for chrome desktop browser and same issues with that. Weaver Xtreme doesn’t play nice with any of the mobile user agents tested.


    Xtreme is a purely responsive theme, all its responsive behavior is based on the width of the screen, nothing else.

    You can use device specific CSS for your content, but as far as the theme is concerned, only the screen width matter. So to simulate mobile devices, just reduce your browser width.

    If you have specific issue with the theme side of thing regarding that, please elaborate


    OK. Got it for responsive theme actions. That works OK, and eliminates the need for a user agent switcher, which is sweet!

    It does expose how a lot of the 3rd party content my site uses is not designed to be automatically responsive, and it still needs to get the general device type in its API parameters to do its complex reformatting.

    So this still doesn’t answer what happened to the weaverii_use_mobile function that I used in WeaverII and still need, and is also still coded in the vimeo shortcode in the theme support plugin. I guess what I am saying is that I still need a simple php technique to determine device type, and am not finding that in the tips or forum content.


    It’s reiterative and somewhat resource intensive because it has to run the new shortcode to get the same result as one simple function call used to, but I tried this and it seems to work, and since it only happens at plugin initialization, it’s probably not too bad:

        $uidx_device = do_shortcode(“[show_if device=’phone’]phone[/show_if]“);
        if ( $uidx_device == ” )
            $uidx_device = do_shortcode(‘[show_if device="smalltablet"]smalltablet[/show_if]‘);
        if ( $uidx_device == ” )
            $uidx_device = do_shortcode(‘[show_if device="tablet"]tablet[/show_if]‘);

    Then I can use the final result to set a global variable to control the rest of my plugin’s php logic. It’s a lot more complicated in practice, because my plugins have to work with sites that are still WeaverII as well as migrating to Weaver Xtreme, so I have to have both coding techniques in place, just in case. Once the various 3rd party vendors I get content from via http APIs get their stuff to be mobile responsive, I might be able to eliminate all of that.


    @weaver would be better place to tell you the best way to gather device type using either the theme resources (if any are available) or PHP.

    I know he has recently added an .is-ipad class which tells me he has some device checking implemented.



    I would add that unless you have some imperative reasons to use specific device checking, you should try to only rely on screen width.

    People and apps on mobile devices frequently change their user agent, so if you rely on this you are never sure if your visitors will see the proper content.

    Screen size allows you to be sure that the content will look good based on the available screen real estate of the device.

    Xtreme has device / OS / size classes you can use (see below) and you can of course use @media rules and all their options.

    Below is an extract of the help file on this

    Weaver Xtreme Helper Classes

    Weaver Xtreme provides quite a few helper classes that can be used to help style your content. You can used these in the any of the PlusHere’s a short summary.


    • .show-desktop – show on devices; add these classes to show or hide by device
    • .hide-desktop – hide on devices
    • .is-desktop – prefix selectors to make rules apply on specific devices
      .is-mobile (either small-tablet or phone)
      .is-smalltablet – note: many phones will be considered smalltablet when in landscape view
      .is-phone – usually when in portrait mode only
      .is-ios – an iOS device: iPhone, iPod, iPad
      .is-ipad – an iPad
      .is-ipod – an iPod
      .is-iphone – an iPhone
      .is-android – any Android device
      .is-windows – any Windows OS
      .is-macos – any Mac OS

    I don’t need specific device checking, just a way to get general/global variable settings for phone, smalltablet, desktop, etc, as I could do with WeaverII. For the most part, unless it is a desktop user and they narrow or widen the screen after the page is loaded, whatever the default screen width is/was (and how that translates to phone, smalltablet, etc,) when the page was requested is what I need. And I explained my imperative reasons for needing this and why using the available css classes were insufficient. It’s not about styling content. I understand that very well.


    It is possible to detect specific mobile devices using PHP’s User Agent sniffing. But there is no real way to detect screen width or basic device type from PHP.

    Weaver Xtreme does have some device specific classes added to <body> (e.g., iPad, iPhone, Android), but that is entirely done using JavaScript when the page is loaded into a specific user browser. It is not available to PHP.

    So, I guess the answer is there is no way to get phone, smalltablet, or desktop information from PHP in Weaver Xtreme. I think a plugin could be written that could make an approximation, but with so many Android devices in so many screen sizes, the methods used by Weaver II are really kind of obsolete. (Fortunately, Weaver II can operate in pure responsive mode.)


    It took lots of work with my main 3rd party content provider’s code, but we got it all working now. We had to implement lots of new css in the child theme for their content, as well as convert a good deal of html in their content from tables to more flexible divs with floats that were no wider than could be displayed on a mobile phone. So sometimes their content is 3 columns wide on desktop, 2 columns on smalltablet, and one column on smart phone. Now, for all the pages I tested with Google WMT mobile friendly test, all pages on the site, including the pages with 3rd party content, now test as mobile friendly, and look good on small tablets and small screen phones as well as desktop.


     Well, sometimes one just needs to bite the bullet and bring things into the current web world. As you noted, things like tables are really obsolete when it comes to good responsive design. Lots of old, non-responsive code is still being used, and that is where fixes are needed, usually. Glad you figure out your issues.

Viewing 14 posts - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.