Jump to content

How can i Add Screen Resolution to PHP Variable and Echo it?


stanleystone69x

Recommended Posts

How can i Add Screen Resolution to PHP Variable and Echo it?

i am quite confused on how to do this as getting resolution is done in javascript right?

 

Please help me with this. i have coded my first wordpress theme and this is the only part i am stuck at :(

 

p.s. I want to save screen height in different variable and screen width in different variable.

You've probably already considered this, but have you looked into CSS media queries? They can be used to format the page after the fact based on the screen size. More information can be found here:

https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Media_queries

Yes i do,

this wp theme i made its a wallpaper site theme : http://wpthemetest.in : see the top right corner. "Your Desktop : 1920 x 1080" i want to make this display the actual resolution of the user, currently it is showing just static text. also once i am able to add width and height to php variable i will be able to use those value in wallpaper download option too.

can you please write me the code for this if its not too long, i would really appreciate that :)

 

you need to use javascript to get the the resolution... you'd have to get it, send it via ajax and all kinds of messy code scenarios. Do you need to know it before the template loads?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.