Display based on mobile user agent
-
I have a shortcode that refers to this function. I am using a mobile theme and I need a way to display the shortcode based on if the user agent is mobile device. I have tried different configurations and narrowed it down to working it this way. I just don’t know how to tell it that “mobile” is “true”.
function getProducts() { $disp = new Display(); ?> <!--if desktop display this way --> <div id='sideNav'> <?php $disp->displayCategories(); ?> </div> <div id="productContents"> <div id="breadcrumbs"> <?php $disp->getDisplayBreadcrumbs(); ?> </div> <div class="description"> <?php $disp->singleOrCat(); ?> </div> <div class="productImage"> <p><em>Click item to enlarge</em></p> <div class="productan"> <?php echo $disp->getSide(); ?> </div> <hr/> </div> </div> <!--if mobile display this way --> <div id='sideNav'> <?php $disp->displayCategories(); ?> </div> <div id="productContents"> <div class="description"> <?php $disp->singleOrCat(); ?> </div> </div> </div> </div>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Display based on mobile user agent’ is closed to new replies.