acf_form_comment::comment_form_field_comment
description
Метод класса: acf_form_comment{}
Хуков нет.
Возвращает
$post_id. (int)
Использование
$acf_form_comment = new acf_form_comment(); $acf_form_comment->comment_form_field_comment( $html );
- $html(обязательный)
- .
Список изменений
| С версии 5.3.8 | Введена. |
Код acf_form_comment::comment_form_field_comment() acf form comment::comment form field comment ACF 6.4.2
function comment_form_field_comment( $html ) {
// global
global $post;
// vars
$post_id = false;
// get field groups
$field_groups = acf_get_field_groups(
array(
'comment' => $post->post_type,
)
);
// bail early if no field groups
if ( ! $field_groups ) {
return $html;
}
// enqueue scripts
acf_enqueue_scripts();
// ob
ob_start();
// render post data
acf_form_data(
array(
'screen' => 'comment',
'post_id' => $post_id,
)
);
echo '<div class="acf-comment-fields acf-fields -clear">';
foreach ( $field_groups as $field_group ) {
$fields = acf_get_fields( $field_group );
acf_render_fields( $fields, $post_id, 'p', $field_group['instruction_placement'] );
}
echo '</div>';
// append
$html .= ob_get_contents();
ob_end_clean();
// return
return $html;
}