Field to select registered image sizes within the WordPress dashboard.
用于在WordPress仪表板中选择注册图像大小的字段。 p>
Compatibility
兼容性 h3>
This ACF field type is compatible with:
此ACF字段类型兼容:
* ACF 5
* ACF 5 p>
How to Use
使用方法 h3>
Once activated, this plugin will create a Image Size field type in ACF.
激活后,此插件将在ACF中创建一个图像大小 em>字段类型。This field type will list all registered field types as a drop down within the field group.
此字段类型将在字段组中作为下拉列表列出所有已注册的字段类型。 p>
To use this field within your custom templates you will use the following code:
要在自定义模板中使用此字段,您将使用以下代码: p>
$my_image_id = get_field('my_image_id'); $ my_image_id = get_field('my_image_id'); // ACF Image return type set to ID for this demo
//此演示的ACF图片返回类型设置为ID
$my_image_size = get_field('my_image_size');
$ my_image_size = get_field('my_image_size');
// The selected image size (eg. large)
//所选的图片尺寸(例如大)
echo wp_get_attachment_image( $my_image_id, $my_image_size );
回声wp_get_attachment_image($ my_image_id,$ my_image_size);
// Output the image based on the ID, and the Image Size selected.
//根据ID和选择的图像尺寸输出图像。
code> pre>