有谁能帮我过滤wp\\u get\\u attachment\\u链接,使它的特定位置链接到“中等”或其他大小的图像,而不是完整大小的图像。我在页面模板中有以下内容:
$args = array( \'post_type\' => \'attachment\', \'numberposts\' => -1, \'post_status\' => null, \'post_parent\' => $post->ID );
$attachments = get_posts($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
echo wp_get_attachment_link( $attachment->ID , array(150,150) );
}
}
我可以添加一个过滤器来添加类或rel,但我找不到任何方法来更改模板中链接的默认(最初上载的)全尺寸图像。。。。以上内容可以通过colorbox(不是插件)创建灯箱,但如果用户上载非常大的图像(即:4000x4000像素以上),链接加载速度会太慢,我不希望公众能够从灯箱下载打印质量的图像。。