Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

srcset max-width Issue #297

Open
michaeljamesdunn opened this issue Jun 2, 2018 · 0 comments
Open

srcset max-width Issue #297

michaeljamesdunn opened this issue Jun 2, 2018 · 0 comments

Comments

@michaeljamesdunn
Copy link

I'm trying to set the Wordpress image srcset max-width to 2048 (for retina, which is 2x my $content_width of 1024) using the function below, but I always end up getting the full-size image on high-res displays anyway (i.e., sizes="(max-width: 3712px) 100vw, 3712px"). Wordpress appears to globally limit that to 1600 in media.php, so I'm not sure why I would ever be getting the full-size of images greater than 1600. Is there something in Independent Publisher that would be overriding these settings?

/* Set new max srcset width */
add_filter('max_srcset_image_width', function($max_srcset_image_width, $size_array){
    return 2048;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant