我的职能中有这一点。php:
function display_images_in_list($size = thumbnail) {
if($images = get_posts(array(
\'post_parent\' => get_the_ID(),
\'post_type\' => \'attachment\',
\'numberposts\' => -1, // show all
\'post_status\' => null,
\'post_mime_type\' => \'image\',
\'orderby\' => \'menu_order\',
\'order\' => \'ASC\',
))) {
foreach($images as $image) {
$attimg = wp_get_attachment_image($image->ID,$size);
echo $attimg;
}
}
}
然后,我的模板页面中有以下内容:<?php display_images_in_list(\'ca_thumb-large\'); ?>
此代码显示前端立柱上的图像列表。我需要添加一个链接来包装每个图像。链接应指向同一图像的较大版本。我有一个较大的图像大小,名称为recipe full,我想在单击时显示它。我想我只需要修改这个函数,但我在这里遇到了麻烦。