Home Forums Weaver Xtreme Theme Firefox User Agent Switcher and Xtreme Re: Firefox User Agent Switcher and Xtreme


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.