forked from tevko/wp-tevko-responsive-images
-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter content to add
srcset
and sizes
This changes our approach from one where `srcset` and `sizes` are written to the image markup in post content to one where the responsive attributes are added on the front end when the page is being rendered. There is a small performance hit but the benefit is worth the tradeoff for what is gained. What exactly do we gain? Glad you asked: * Automatically extend support to images in posts published before we responsive image support was available. * Removes the need to update the markup in TinyMCE when the image size is changed. * Keeps `sizes` attributes, which should probably be adjusted based on the needs of the theme, from being stored in the database. * Is non-destructive if a site needs to change available image sizes and regenerate thumbnails. Changes: * Removes the old JS code for handling markup changes in TinyMCE * Adds `tevkori_filter_content_images()` as a display filter. * Adds `_tevkori_filter_content_images_callback()` to process filtered images. * Adds tests
- Loading branch information
Showing
3 changed files
with
184 additions
and
121 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters