Get field properties
<?php CFS()->get_field_info( $field_name, $post_id ); ?>
Parameter | Required | Type | Notes |
---|---|---|---|
$field_name | N | mixed | Enter a field name, or FALSE for all fields |
$post_id | N | mixed | Enter a post ID, or FALSE to use the current post ID |
Examples
Get a field label
<?php
$props = CFS()->get_field_info( 'first_name' );
echo $props['label'];
Get a field label (alternate)
<?php
$props = CFS()->get_field_info();
echo $props['first_name']['label'];
Get all field properties (as an associative array)
<?php
$props = CFS()->get_field_info();
Output all choices for a select field
<?php
$props = CFS()->get_field_info( 'my_select' );
foreach ( $props['options']['choices'] as $value => $label ) {
echo '<div>' . $value . ' = ' . $label . '</div>';
}