Jump to content

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

Edited by cyberRobot

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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.