0

有没有人找到方法来更好地控制使用 Wordpress Jetpack“通过电子邮件发布”功能时创建的图像?

理想情况下,当通过电子邮件发布时,我希望我的图像与电子邮件所附的大小相同。正如通过电子邮件发布一样,仅将它们最大化为 1024x1024。

4

1 回答 1

1

您可以通过将以下代码插入到您的 functions.php 中来解决此问题

add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 );
add_filter( 'the_content', 'remove_width_attribute', 10 );

function remove_width_attribute( $html ) {
    $html = preg_replace( '/(width|height)="\d*"\s/', "", $html );
    return $html;
}

如此处所述:http: //css-tricks.com/snippets/wordpress/remove-width-and-height-attributes-from-inserted-images/

于 2014-02-25T21:41:58.140 回答