Change $content_width based on screen size (functions.php)

Question

I’ve got a WordPress install where I’m trying to change this content_width code:

if( ! isset( $content_width ) ) $content_width = 290;

in my functions.php file based on the users screen size. I’ve tried using CSS media queries, but for our particular use-case, I need to be able to change this in the functions.php file based on the users screen size.

Ideally 1080 for Desktop, 720 for tables, and 290 for mobile.

Any ideas?

0
Jason 5 months 2020-12-25T02:10:24-05:00 0 Answers 3 views 0

Leave an answer

Browse
Browse