mobile devices & code bloat

resolved (6 posts) (2 voices)

  1. suzibeau

    Hi, I'm trying to remove some elements from my mobile site to reduce code bloat. I've found this topic in which you explain how to insert a desktop_only function and use desktop_only shortcode. Thanks - very helpful. Questions:

    1. Would this have the effect of telling the mobile browser not to "get" the files, or would it be more like using CSS to tell it not to display the files (in which case it still has to process a bunch of code)?

    2. Is there a way to manage the <head> section of the site on a mobile device. I'd like to eliminate some unnecessary style sheets and jquery calls.

    Posted 3 years ago #
  2. suzibeau

    PS. Could I use [desktop_only] shortcode in the "additional headers" window, to prevent the mobile site from fetching some of my js files?

    Posted 3 years ago #
  3. Elliott

    Hello suzibeau,

    It sounds like your wanting to hide some of the header text on mobiles correct? You can use CSS to hide the header elements,

    To hide them only on mobile devices then add the CSS in Dashboard -> your theme -> Responsive & Mobile -> Mobile CSS.

    Posted 3 years ago #
  4. suzibeau

    Thanks for your quick reply, Elliot. That info is helpful with regard to hiding or displaying page elements in the header. But what I am looking for is a way to remove links to style sheets, scripts etc, from within the head tag.

    In General Settings > Additional Headers, I see that I can add links (to style sheets, scripts etc) to the head tag. But this applies to all pages, mobile or otherwise. Is there any way to target specific pages? Or control what's in the head tag of the mobile pages?

    Posted 3 years ago #
  5. Elliott

    No, not that I know of.

    Posted 3 years ago #
  6. suzibeau

    This worked. I inserted this code in the header.php file, which has the effect of calling .js files only when needed (in the desktop version). I had to do this because of a jquery conflict between tablesorter scripts and the responsive nav menu.

    <!-- if NOT mobile, then insert tablesorter script calls (replace ' with " in HTML)-->

    <?php global $mysite; if( !isset( $mysite->mobile ) ) { echo '
    <script type="text/javascript" src="/scripts/tablesorter.js"></script>
    '; } ?>

    Posted 2 years ago #


You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme