I am searching to obtain desktop and mobile functionality in one wordpress theme.

You will find several solutions available which use a publish/get approach to send the display size to php. fex: http://www.openjs.com/articles/ajax_xmlhttp_using_post.php

Now my question is how you can implement this in wordpress. For reference, the php is structured such as this:





So now you ask ,:

Can there be any method of getting the screen height/width/viewport right into a PHP variable before get_header() will get known as from index.php?

You will find a couple of nice Wordpress plug ins open to identify mobile products. My trouble with individuals is they use mostly user agent data that's hardly reliable. I would like my design to alter in line with the customers viewport. And for your i should also manipulate the wordpress PHP calls within the theme.

Have you thought about using media queries in CSS rather than programming via php?

This works if you're only focusing on modern mobiles like the apple iphone and android products.

e.g. <link rel="stylesheet" type="text/css" media="screen and (max-device-width: 480px)" href="mobile.css" />