justcoded / just-responsive-images

WordPress Plugin to support better responsive images with <picture> tag, backgrounds, retina support etc.
48 stars 8 forks source link

feat(filter): added filter to set tag type globally #31

Closed therajumandapati closed 5 years ago

therajumandapati commented 5 years ago

This PR adds a filter to set the tag for the function rwd_attachment_image. It allows theme developers to set a default tag type whether it is picture or img.

Themes can override by doing this:

function override_jri_tag_type() {
    return 'img';
}

add_filter('rwd_tag_type', 'override_jri_tag_type');
therajumandapati commented 5 years ago

@aprokopenko Let me know what you think about this. This is especially helpful when a theme has more than 10 calls to rwd_attachment_image or get_rwd_attachment_image, it removes the need to override the value of $tag in every function call by enabling theme to override it globally, just once.

aprokopenko commented 5 years ago

Hi @mvpspl619,

I don't like adding too many filters, but unfortunately, this is the way WP works. Merging your request

therajumandapati commented 5 years ago

Thank you for merging @aprokopenko. Do you know when this will be released?

aprokopenko commented 5 years ago

Already released in 1.6.4