Get field() (ACF): verschil tussen versies
Naar navigatie springen
Naar zoeken springen
(Nieuwe pagina aangemaakt met ' == See also == * the_field()') |
|||
Regel 1: | Regel 1: | ||
+ | <code>get_field()</code> is a PHP function of ''Advanced Custom Fields (ACF)''. | ||
+ | |||
+ | [https://www.advancedcustomfields.com/resources/get_field/]: | ||
+ | |||
+ | <pre> | ||
+ | Returns the value of a specific field. | ||
+ | |||
+ | Intuitive and powerful (much like ACF itself ?), this function can be | ||
+ | used to load the value of any field from any location. Please note | ||
+ | that each field type returns different forms of data (string, int, | ||
+ | array, etc). | ||
+ | </pre> | ||
+ | |||
+ | == Syntaxis == | ||
+ | |||
+ | <pre> | ||
+ | get_field($selector, [$post_id], [$format_value]) as mixed | ||
+ | </pre> | ||
+ | |||
+ | * <code>$selector</code> (string, required): The field name or field key. | ||
+ | * <code>$post_id</code> (mixed, optional): The post ID where the value is saved. Defaults to the current post. | ||
+ | * <code>$format_value</code> (boolean, optional): Whether to apply formatting logic. Defaults to true. | ||
+ | |||
+ | Return: (mixed) The field value | ||
== See also == | == See also == | ||
* [[The field (ACF) | the_field()]] | * [[The field (ACF) | the_field()]] | ||
+ | |||
+ | == Sources == | ||
+ | |||
+ | * https://www.advancedcustomfields.com/resources/get_field/ |
Huidige versie van 1 aug 2022 om 09:16
get_field()
is a PHP function of Advanced Custom Fields (ACF).
[1]:
Returns the value of a specific field. Intuitive and powerful (much like ACF itself ?), this function can be used to load the value of any field from any location. Please note that each field type returns different forms of data (string, int, array, etc).
Syntaxis
get_field($selector, [$post_id], [$format_value]) as mixed
$selector
(string, required): The field name or field key.$post_id
(mixed, optional): The post ID where the value is saved. Defaults to the current post.$format_value
(boolean, optional): Whether to apply formatting logic. Defaults to true.
Return: (mixed) The field value