Jump to content
stanleystone69x

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

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.

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

just use javascript to update the theme when the dom loads, you don't need to know these values in your php script.

screen.width;
screen.height;

Share this post


Link to post
Share on other sites

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.