【问题标题】:Wordpress jetpack post by email - controlling image sizeWordpress jetpack 通过电子邮件发布 - 控制图像大小
【发布时间】:2014-02-25 21:41:58
【问题描述】:

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

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

【问题讨论】:

    标签: wordpress jetpack


    【解决方案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/

    【讨论】:

      猜你喜欢
      • 2018-09-20
      • 1970-01-01
      • 1970-01-01
      • 2012-04-24
      • 2023-03-02
      • 1970-01-01
      • 2012-06-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多