-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreadme.txt
46 lines (31 loc) · 1.44 KB
/
readme.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
=== ACF Get Image ===
Contributors: giangel84
Tags: acf, field, image
Requires at least: 4.9
Tested up to: 5.3.2
Requires PHP: 7.1
Stable tag: 1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Get the image URL and ALT as array, regardless output format selected for the image field (Choose Array, URL or ID will be equals).
== Description ==
Annoying in select the proper output format for yours ACF custom image fields?
With this plugin you can get the URL and the ALT image's property easily, regardless to the output format selected in ACF image field.
In any case (Array output, URL output, ID output), the new 'get_field_image' function will return an array with the image's attributes.
Usage `<?php $my_image = get_field_image($field, $size); ?>`
$field (string, name of the ACF field)
$size (string, name of the image size)
Return: Array('url'=>$url, 'alt'=>$alt);
== Example ==
`<?php $my_image = get_field_image('my_image', 'thumbnail'); ?>
<img src="<?php echo $my_image['url']; ?>" alt="<?php echo $my_image['alt']; ?>" />
`
== Installation ==
This section describes how to install the plugin and get it working.
e.g.
1. Upload `hw-acf-get-image` folder to the `/wp-content/plugins/` directory
2. Activate the plugin through the 'Plugins' menu in WordPress
3. Read the example to understand how it works.
== Changelog ==
= 1.0 =
* First stable and tested code.