我想在不使用其他插件的情况下使用标准Wordpress图库,并坚持使用图库短代码。因此,我知道我可以更改缩略图的大小,这些缩略图显示在图库网格中,例如[gallery size="xyz" link="file"]
.
但是我不满意Wordpress打开最大的文件,当点击其中一个缩略图时,我想声明一个不同的大小,这是我使用add_image_size( \'galleryimage\', 900, 900 );
在我孩子的功能中。当然是php。
以下是我用于在静态页面上生成库的代码:
<?php
$people_attachments = new WP_Query( array(
\'post_type\' => \'attachment\',
\'post_status\' => \'inherit\',
\'posts_per_page\' => 0,
\'category_name\' => \'people\', // note: use category SLUG
) );
$people_id_array = array();
if ( $people_attachments->have_posts() ) : while ( $people_attachments->have_posts() ) : $people_attachments->the_post();
$people_id_array[] = get_the_ID();
endwhile; endif;
// Important!
wp_reset_postdata();
$people_ids = implode( \',\', $people_id_array );
echo do_shortcode( \'[gallery link="file" columns="5" order="DESC" orderby="ID" include="\' . $people_ids . \'"]\' );
?>
如何添加目标图像大小(单击时要显示的链接图像的大小)?