我不知道为什么,但此代码将图像大小作为缩略图 150x150
enter$query = new WP_Query( array( 'post_type' => 'custom-post', posts_per_page' => -1 ) );if( $query->have_posts() ){
while($query->have_posts()){
$query->the_post();
$image_query = new WP_Query( array( 'post_type' => 'attachment', 'post_status' => 'inherit', 'post_mime_type' => 'image', 'posts_per_page' => -1, 'post_parent' => get_the_ID() ) );
while( $image_query->have_posts() ) {
$image_query->the_post();
echo wp_get_attachment_image( get_the_ID() );
}
}}
是否可以更新此代码以更改图像大小为中号或大号?
你能用这个测试吗?
wp_get_attachment_image( get_the_ID(), $size = 'large');
如果您想了解更多关于这里阅读:
https://developer.wordpress.org/reference/functions/wp_get_attachment_image/
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句