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.
Something perhaps like this?:
if (isset($_GET['width'])) {
$width = $_GET['width'];
if ($width <= 480) { //mobile devices
if( ! isset( $content_width ) ) $content_width = 290;
} elseif ($width <= 720){ //tablets
if( ! isset( $content_width ) ) $content_width = 720;
} else { //desktops
if( ! isset( $content_width ) ) $content_width = 1080;
}
echo $content_width;
}
Let me know if you have any suggestions. Thanks!