-
Notifications
You must be signed in to change notification settings - Fork 53
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
Filtering function updates #206
Conversation
|
||
// Pass height and width to `tevkori_get_sizes_string()`. | ||
/** | ||
* Pass the 'height' and 'width' to 'wp_get_attachment_image_sizes()' to avoid |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'tevkori_get_sizes()'
The code looks good to me. |
Wow, this is a huge shift: no longer matching the |
Hi @bradt. We removed that custom query recently in order to speed up the display filter. Some of the relevant conversation can be found in the meeting logs from Sept. 25. Once we no longer needed the At some point, it would be nice to handle cases where we're not able to get the |
Awesome, great work pushing this forward! 😃 |
740385b
to
38f5f87
Compare
Now that we're no longer using a `preg_replace_callback` function in `tevkori_filter_content_images()`, it doesn't make as much sense to use the callback function the way we originally set it up. However, rather that merging the two function, this turns the callback into a useful utility function that accepts an `img` element and returns the HTML including `srcset` and `sizes` attributes if we can. Additionally, since we only add `srcset` and `sizes` when we're able to parse the attachment id from the markup, we also no longer need to limit our matches in the content filter by files containing the path to our uploads folder. This resolves #190.
38f5f87
to
c77b441
Compare
Fixed the inline docs as noted by @jaspermdegroot and rebased to a single commit so it can be merged cleanly. |
…dates Refactor display filtering functions Now that we're no longer using a preg_replace_callback function in tevkori_filter_content_images(), it doesn't make as much sense to use the callback function the way we originally set it up. However, rather that merging the two function, this turns the callback into a useful utility function that accepts an img element and returns the HTML including srcset and sizes attributes if we can. Additionally, since we only add srcset and sizes when we're able to parse the attachment id from the markup, we also no longer need to limit our matches in the content filter by files containing the path to our uploads folder. This resolves #190.
Now that we're no longer using a
preg_replace_callback
function intevkori_filter_content_images()
, it doesn't make as much sense to usethe callback function the way we originally set it up. However, rather
that merging the two function, this turns the callback into a useful
utility function that accepts an
img
element and returns the HTMLincluding
srcset
andsizes
attributes if we can.Additionally, since we only add
srcset
andsizes
when we're able toparse the attachment id from the markup, we also no longer need to limit
our matches in the content filter by files containing the path to our
uploads folder. This resolves #190.