acf_field_taxonomy::render_field_select
Create the HTML interface for your field
Метод класса: acf_field_taxonomy{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$acf_field_taxonomy = new acf_field_taxonomy(); $acf_field_taxonomy->render_field_select( $field, $nonce );
- $field(обязательный)
- .
- $nonce(обязательный)
- .
Список изменений
| С версии 3.6 | Введена. |
Код acf_field_taxonomy::render_field_select() acf field taxonomy::render field select ACF 6.8.8
function render_field_select( $field, $nonce ) {
// Change Field into a select
$field['type'] = 'select';
$field['ui'] = 1;
$field['ajax'] = 1;
$field['nonce'] = $nonce;
$field['choices'] = array();
// value
if ( ! empty( $field['value'] ) ) {
// get terms
$terms = $this->get_terms( $field['value'], $field['taxonomy'] );
// set choices
if ( ! empty( $terms ) ) {
foreach ( array_keys( $terms ) as $i ) {
// vars
$term = acf_extract_var( $terms, $i );
// append to choices
$field['choices'][ $term->term_id ] = $this->get_term_title( $term, $field );
}
}
}
// render select
acf_render_field( $field );
}