Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

How To make Atahualpa pass Google's 'Mobile-Friendly Test'


  #1  
Old Apr 20, 2015, 05:22 AM
juggledad's Avatar
juggledad
 
23,492 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
To get your Atahualpa site pass the Google 'Mobile-Friendly Test' do the following. This will make your site mobile friendly. If you don't pass the test after doing this - disable ALL your plugins and test again to see if a plugin is causing the issue.

1) go to ATO->Style & configure LAYOUT->Layout WIDTH and type (FLUID or FIXED) and set it to a percentage (as opposed to a 'fixed' width) then set the 'Layout MIN width' option to 320 (iPhone 4 size) or remove it altogether.

2) add the following to ATO->Add HTML/CSS Inserts->HTML Inserts: Header
HTML Code:
<meta name=viewport content="width=device-width, initial-scale=1">
3) add the following to ATO->HTML Inserts: Body Tag
HTML Code:
onresize="OnResizeDocument()"
4) Add the following to ATO->Add HTML/CSS Inserts->HTML Inserts: Body Bottom
HTML Code:
<script>
jQuery(document).ready(function($) {
    if( $(window).width() < 768 ) {
        // If any left sidebar exists
        if ( $('#left').length || $('#left-inner').length ) {   
            $("#middle").detach().prependTo('#bodyrow'); 
        }
    }
});
</script>
<script type="text/javascript">
        function OnResizeDocument () {
 if( window.innerWidth < 767 ) {
    jQuery(function($) {
              $("#middle").detach().prependTo('#bodyrow'); 
           });
        }
if( window.innerWidth > 767 ) {
    jQuery(function($) {
            $("#left").detach().prependTo('#bodyrow'); 
          });
        }
    }
    </script>
5) add the following to ATO->Add HTML/CSS Inserts->CSS Inserts
HTML Code:
@media only screen and (max-width: 767px) {
    table#layout,
    table#layout > tbody,
    table#layout > tbody > tr,
    table#layout > tbody > tr > td,
    table#layout > tr,
    table#layout > tr > td,
    table#layout td#header,
    table#layout td#left,
    table#layout td#left-inner,
    table#layout td#middle,
    table#layout td#right,
    table#layout td#right-inner,
    table#layout td#footer {
        display: block;
    }
    table#layout > colgroup {
        display: none;
    }
    div#wrapper,
    td#middle {
        width: auto;
    }
}
.hentry img { 
    max-width: 100%;    
    height: auto !important; 
    display: block !important; 
}
Note: in steps 4 and 5 you can adjust the number (767) to suit your choice.

Thanks to Flynn, sawyerjw, yukoner, kayphoonstar and extremecarver for their contributions.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; Apr 21, 2015 at 10:39 AM.
  #2  
Old Apr 20, 2015, 05:20 PM
SharonJ's Avatar
SharonJ
 
635 posts · Sep 2010
Duncan BC Canada
Is this better than using a plugin like WPTouch?
  #3  
Old Apr 20, 2015, 05:53 PM
juggledad's Avatar
juggledad
 
23,492 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
If it works for you there is one less plugin you need to deal with....
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #4  
Old Apr 21, 2015, 06:18 AM
tfarrell
 
43 posts · Dec 2012
Ireland
Hello
I like the facility to make the site mobile friendly but there is a lot of code work for non coders. Any plans to include this in a future update as an option to select.
Tom Farrell

Last edited by juggledad; Apr 21, 2015 at 06:52 AM.
  #5  
Old Apr 21, 2015, 06:55 AM
lmilesw's Avatar
lmilesw
 
10,172 posts · Jul 2009
Central New York State USA
Quote:
Originally Posted by tfarrell
there is a lot of code work for non coders
This is only copying and pasting three pieces of code. That doesn't seem like much code work.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #6  
Old Apr 21, 2015, 09:56 AM
extremecarver
 
100 posts · Jul 2009
You forgot IMHO:
ADD this to the body tag ("HTML Inserts: Body Tag"):
Code:
body onresize="OnResizeDocument()"
However - what would still be needed is code to remove the menu if smaller then X pixels...
(then use a plugin like Responsive Menu which already works well with the above code and will be shown automatically as the sidebar is detached - but that is of course no use as long as the normal menu is still showing.).
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org
  #7  
Old Apr 21, 2015, 10:08 AM
juggledad's Avatar
juggledad
 
23,492 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Quote:
You forgot IMHO:
ADD this to the body tag ("HTML Inserts: Body Tag"):....
Code:
Yup, I forgot to add that (head slap...fixed now)

and actualy you don't need the word 'body'

as for the menus, not everyone will want to do that and see the other thread to follow up on it.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; May 5, 2015 at 06:38 PM.
  #8  
Old Apr 21, 2015, 01:51 PM
extremecarver
 
100 posts · Jul 2009
Oh - and just another optional one:

If you set image sizes - they will stick out of your viewport - very bad. Instead of going through all your posts/pages fixing this - just add the following to your CSS inserts:

Code:
img {
     border: 0 none;
     height: auto;
     max-width: 100%;
     vertical-align: middle;
}
(should we add max-height: 100%; too?). Note - I found this code somewhere here - but height: auto; was missing - so images got distorted.
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org
  #9  
Old May 2, 2015, 08:14 AM
thetravelchronicle
 
88 posts · May 2009
I'm using Page Builder by SiteOrigin and Responsive Menu, and found that I only needed that first line of code in the ATO->Add HTML/CSS Inserts->HTML Inserts: Header

<meta name=viewport content="width=device-width, initial-scale=1">

However, Responsive Menu is still recommending that I use:

<meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' />

Any thoughts on whether one is preferable over the other in Atahualpa?
  #10  
Old May 3, 2015, 02:36 PM
extremecarver
 
100 posts · Jul 2009
user-scalable=no
--- I would not use it. I hate it when I cannot zoom out on a page because the content is due to some circumstance actually bigger than the viewport - and you are forced to pan around.

maximum-scale=1 - is more or less stating the same in your above example - you disallow the user to zoom in. I consider this bad form too.

Setting maximum-scale when user-scalable=no is actually doubling your statement. I don't know why this is proposed - maybe some browsers only respect the one or the other? So do it like indicated if you want to forbid zooming in/out. Don't do it if you want to allow the user to zoom in!

See also: http://stackoverflow.com/questions/2...e-attribute-in
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org

Last edited by extremecarver; May 3, 2015 at 02:38 PM.
  #11  
Old May 3, 2015, 08:12 PM
thetravelchronicle
 
88 posts · May 2009
Thanks for the insight.

My first guess was that zooming causes problems with Responsive Menu, but I just tried it with good results. As I zoom in, the various widgets stack up in a single column just as they do when I resize the browser.

At least if I get a mystery condition at some point I'll have a place to start looking.
  #12  
Old May 5, 2015, 12:50 PM
blondie
 
7 posts · Jul 2011
Thank you, JD for this code which works beautifully! I am currently working on a client's site, http://hope2heal.net, and have passed Google's mobile-friendly test. However, I have not been able to find code to make the header size responsive to the mobile device size. Is there a way to have the header image resize or do I have to make smaller versions of the image and somehow code them in the HTML/CSS inserts area to apply for all device sizes? Thanks a million!
  #13  
Old May 6, 2015, 05:49 AM
juggledad's Avatar
juggledad
 
23,492 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Try this
1) add the following to ATO->Add HTML/CSS Inserts->HTML Inserts: Header
HTML Code:
<meta name=viewport content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
2) move your image out of the theme/atahualpa/images/header folder - you can put it in the media library or create a new folder in the wp-content folder ad put it there
2) at ATO->Style & edit HEADER AREA->Configure Header Area - remove teh %image and replace it with
HTML Code:
<img class="img-responsive" src="http://yourdomain.com/...path-to-the-image.../header-new.jpg" width="753" height="369" /> %pages
you'll probably need to do some centering of the image, but I'll leave that as an exercise for you.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; May 6, 2015 at 06:02 AM.
  #14  
Old May 6, 2015, 03:37 PM
blondie
 
7 posts · Jul 2011
You are the wizard! Thank you very much for sharing your genius with us - its perfect and no centering required!!!
  #15  
Old May 8, 2015, 11:03 PM
cefiar
 
24 posts · Jun 2014
Melbourne, Australia
Moderater note: see PATCH 3723-03: lack of a space in the <body..> when using 'HTML Inserts: Body Tag'

Note:
You need to put a single space before `onresize="OnResizeDocument()"`, as it seems it just gets appended directly onto the existing body string without a space, leading to incorrect HTML in the body tag. In my case I ended up with it being directly appended to the closing " in the body class statements.

Last edited by juggledad; May 12, 2015 at 04:50 AM.
  #16  
Old May 10, 2015, 03:24 PM
juggledad's Avatar
juggledad
 
23,492 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
@cefiar - good find, and I'll bet it happens in IE. Safari, FireFox and Chrome seem to be able to handle the missing space fine.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #17  
Old May 10, 2015, 06:06 PM
cefiar
 
24 posts · Jun 2014
Melbourne, Australia
No idea how it affects IE. I just picked it up when I was looking at the source, as the source viewer I use highlighted it as an anomaly and brought it to my attention.

Many thanks for the above BTW. In my case, the .hentry img section caused problems with the default gallery I use. I removed the section:

Code:
.hentry img { 
    max-width: 100%;    
    height: auto !important; 
    display: block !important; 
}
... then added some CSS (see below) within the section:
Code:
@media only screen and (max-width: 767px)
The site I look after (an NP community group) uses the built-in WP galleries a lot, so I ended up forcing the thumbnails down to 90px (from the default) to get it to fit without extending out of the viewport. We're only displaying 3 thumbnails wide per post, so this just fits in 320px with a little padding.

Code:
.attachment-thumbnail { width: 90px; height: 90px; }
I also dropped our logo width down in size from 135px to 100px, to make the top header a bit neater in size:

Code:
.logo { width: 100px; height: auto; }
And I changed the Site Title font a bit, mainly to reduce vertical whitespace:

Code:
.blogtitle { line-height: 1; margin: 0.5em 0 0; }
Note: These are NOT recommendations, just useful ideas for people if you want to tailor the experience a bit. I've added a bunch of CSS to do things like move my Social Media icons out of the top bar (back into the Sidebar they're implemented in), so they don't overlap my header when the screen size shrinks.
  #18  
Old May 12, 2015, 12:15 PM
extremecarver
 
100 posts · Jul 2009
Well - I was really annoyed by all the Size Tap Targets problems in Google Pagespeed Mobile test - so I optimized many more things. I now score 100/100 Usability if it's not about links in main body text being too close to each other (that one is tough to solve without rewriting/reformatting your website - so think about it - but I guess for most of us except on frontpage or other very important pages - just let it be).

So some more tips - CSS inserts:
Code:
@media only screen and (max-width: 800px) {
    table#layout,
    table#layout > tbody,
    table#layout > tbody > tr,
    table#layout > tbody > tr > td,
    table#layout > tr,
    table#layout > tr > td,
    table#layout td#header,
    table#layout td#left,
    table#layout td#left-inner,
    table#layout td#middle,
    table#layout td#right,
    table#layout td#right-inner,
    table#layout td#footer { display: block; }
    table#layout > colgroup { display: none; }
    div#menu1 { display: none; }
    div#wrapper,
    td#middle { width: auto; }
    div#toc_container { line-height: 195%; }
    h1 { font-size: 1.8em; font-weight: normal; line-height: 1.2; margin: 0.3em 0 10px; color: #7F2F2F; }
    h2 { font-size: 1.65em; font-weight: bold; line-height: 1.3; margin: 1em 0 .2em; }
    h3 { font-size: 1.5em; font-weight: bold; line-height: 1.3; margin: 1em 0 .2em; }
    h4 { font-size: 1.3em; font-weight: bold; line-height: 1.35; margin: 1.33em 0 .2em; }
    h5 { font-size: 1.2em; margin: 1.67em 0; line-height: 1.4; font-weight: normal; }
    h6 { font-size: 1.2em; margin: 1.67em 0; line-height: 1.4; font-weight: normal; }
    p { font-size: 1.05em; margin: 1.67em 0; line-height: 1.5; font-weight: normal; }
}
As you can see - I inserted title and general text size into here. I do recommend to change font size and spacing between mobile view and normal desktop view. So just use this block once for your mobile - once for your normal CSS block with proper values and test around with it. (In general I would recommend against Atahualpa 0.8em default size. Make it 0.85 or 0.9 - too many users with High DPI screens nowadays and then 0.8em is just too small as default anyhow.


Code:
 div#toc_container { line-height: 195%; }
-- This one is Table of Contents Plus plugin - if you use it - best either change line-height so it passes in googles tap target size test - or use display:none to not show it on mobile phones at all.



General usefull CSS inserts rules:
Code:
div.widget ul li {
  margin:6px 0 12px 0px; }
Makes sure your Recent Posts or Recent Comments widgets (by Atahualpa theme) have a bigger spacing in order to pass on google pagespeed.


Analyse your page with Firebug and google pagespeed to find out more problematic widgets - e.g. for me s2member login widget:
Code:
div#ws-plugin--s2member-pro-login-widget {
  line-height: 140%;
  font-size: 1.15em; }
For which I also change font-size and line-height.


Code:
.comment-meta a { margin:0px 15px 0px 0px;
line-height: 200%;}
Now this one is a must if you show comments in your Atahualpa themed site. It introduces empty space between data and reply link for your comments. Highly recommended (why is there line-height - well without it if this line is split into two lines due to limited width - it will insert enough space). I placed it here in general CSS section - because the space is really wellcome on desktop too (and line-height does not matter).




Then goto ATO Next-Previous Navigation and set:
Show Page Numbers (Pagination) for COMMENTS Navigation
to NO.


Last but not least - Atahualpa footer on posts/pages is not mobile friendly. I solved it by changing Footer Homepage and Footer Multi Post to:
%date('F jS, Y')% | %tags-linked('Tags: ', ', ', ' | ')% %comments('Leave a comment', 'One comment', '% comments', 'Comments are closed')% %edit(' | ', 'Edit this post', '')%

(note I took out category - you could alternatively try to get in some decent spacing - I did not manage that however).


Now you only have to see for additional issues in Pagespeed. E.g. I had one text widget (google feedburner subscribe button - code copied from google) for which I needed to introduce a &nbsp line break in order to get it work well.
__________________
Don't settle for lousy expensive Maps - Get free Maps based on Openstreetmap with great autorouting for cyclists, hikers and Mountainbikers at http://openmtbmap.org

Last edited by extremecarver; May 12, 2015 at 12:24 PM.
  #19  
Old May 27, 2015, 06:59 AM
Ilke
 
126 posts · Aug 2010
Hi Juggeldad,

when I follow your instructions,

- the header is responsive on mobile devices in both directions but not broad enough for my website (900px),

- the content seems to shrink in relation to the header, so it isn't spread over the whole screen but too narrow,

- I can't use rotating header images

What am I doing wrong? Is there any way to fix these issues?
  #20  
Old May 27, 2015, 06:03 PM
juggledad's Avatar
juggledad
 
23,492 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Quote:
- the header is responsive on mobile devices in both directions but not broad enough for my website (900px),
are you using the full width header option?
Quote:
- the content seems to shrink in relation to the header, so it isn't spread over the whole screen but too narrow,
I'd have to see this, the content does not shrink for me - have you disabled ALL your plugins?
Quote:
- I can't use rotating header images
I can - did you disable all your plugins?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #21  
Old May 28, 2015, 01:05 AM
Ilke
 
126 posts · Aug 2010
The website in question is www.gabrieledziemba.de

The full width header option is switched to NO,
The width of the header image was set to 900px, as is the fixed layout width (is that causing the problem?), but I changed it to your 753px, because 900 wasn't responsive in the same way.

And since I now put only one url of one header image into the ATO Style & Edit Header Area, there are no rotating images anymore.

On mobile phone you see how the content, which adjusted nicely to the screen before I made use of the responsive header code, is way too narrow.

Best,
Ilke
  #22  
Old May 28, 2015, 01:08 AM
Ilke
 
126 posts · Aug 2010
ALL plugins are disabled.
  #23  
Old May 28, 2015, 01:14 AM
Ilke
 
126 posts · Aug 2010
Actually, when I click on another page, the content is fine and adjusts well, but the header is not responsive.
  #24  
Old May 28, 2015, 05:02 AM
juggledad's Avatar
juggledad
 
23,492 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
try changing the width="753" height="369" to width="100%" height="100%"
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #25  
Old May 28, 2015, 05:31 AM
Ilke
 
126 posts · Aug 2010
Great! That did the trick, it works wonderfully. Only on a tablet held horizontally the header image gets distorted a bit (the height doesn't stay in proportion but increases).

The last question remaining is the rotation of the header images. Any way that is possible, you think?

I really appreciate your help, I'll donate right now.

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How To: make Atahualpa more responsive/mobile friendly bswb97 Atahualpa 3 Wordpress theme 16 Jan 10, 2015 11:22 AM
Trying to use CCS to make Atahualpa Smart Phone Friendly Megan1967 Atahualpa 3 Wordpress theme 7 Jul 31, 2014 02:28 PM
plugin that shows a mobile-friendly version Atahualpa site Carme Plugins & Atahualpa 11 May 3, 2014 07:17 PM
Possible to make category plugin friendly araneum Page & Category Menu Bars 1 Feb 9, 2009 04:56 PM


All times are GMT -6. The time now is 10:45 PM.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.