Wordpress 4.4:从 functions.php 更改 media.php 中的 max_srcset_image_width
Wordpress 4.4: Change max_srcset_image_width in media.php from functions.php
Wordpress 使用以下行定义 media.php 中新 srcset 属性中包含的最大分辨率:
$max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array );
有什么方法可以改变我的主题的值(通过挂钩等)functions.php?现在我在 media.php 本身更改了它(不推荐 - 我知道......)。
我已成功将其添加到我的 functions.php 文件中
function new_srcset_max($max_width) {
return 2000;
}
add_filter('max_srcset_image_width', 'new_srcset_max');
Wordpress 使用以下行定义 media.php 中新 srcset 属性中包含的最大分辨率:
$max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array );
有什么方法可以改变我的主题的值(通过挂钩等)functions.php?现在我在 media.php 本身更改了它(不推荐 - 我知道......)。
我已成功将其添加到我的 functions.php 文件中
function new_srcset_max($max_width) {
return 2000;
}
add_filter('max_srcset_image_width', 'new_srcset_max');