admin管理员组文章数量:1333210
Is possible to assign a default class to the images that are part of a post content? I have a problem with teh layout, this because the attached images insetred inside a post will break my bootstrap layout. I want to assign a default class so the user when add an image into the content will have the class assigned and the layout will not break.
Is possible to assign a default class to the images that are part of a post content? I have a problem with teh layout, this because the attached images insetred inside a post will break my bootstrap layout. I want to assign a default class so the user when add an image into the content will have the class assigned and the layout will not break.
Share Improve this question asked Jul 8, 2020 at 10:59 wpnewbiewpnewbie 135 bronze badges2 Answers
Reset to default 0As you are using bootstrap you can add img-fluid
helper class to images like this.
function example_add_img_class( $class ) {
return $class . ' img-fluid';
}
add_filter( 'get_image_tag_class', 'example_add_img_class' );
get_image_tag_class
filter allows to add custom css class along side WordPress default classes. Read more about the filter here
I guess you seeking of get_image_tag_class filter.
本文标签: Assign custom class to post content images
版权声明:本文标题:Assign custom class to post content images 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742283048a2446448.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论