acf_get_field_group_style()
acf_get_field_group_style
Returns the CSS styles generated from field group settings.
Хуки из функции
Возвращает
Строку.
.
Использование
acf_get_field_group_style( $field_group );
- $field_group(массив) (обязательный)
- The field group array.
Список изменений
С версии 5.0.0 | Введена. |
Код acf_get_field_group_style() acf get field group style ACF 6.0.4
function acf_get_field_group_style( $field_group ) { // Vars. $style = ''; $elements = array( 'permalink' => '#edit-slug-box', 'the_content' => '#postdivrich', 'excerpt' => '#postexcerpt', 'custom_fields' => '#postcustom', 'discussion' => '#commentstatusdiv', 'comments' => '#commentsdiv', 'slug' => '#slugdiv', 'author' => '#authordiv', 'format' => '#formatdiv', 'page_attributes' => '#pageparentdiv', 'featured_image' => '#postimagediv', 'revisions' => '#revisionsdiv', 'categories' => '#categorydiv', 'tags' => '#tagsdiv-post_tag', 'send-trackbacks' => '#trackbacksdiv', ); // Loop over field group settings and generate list of selectors to hide. if ( is_array( $field_group['hide_on_screen'] ) ) { $hide = array(); foreach ( $field_group['hide_on_screen'] as $k ) { if ( isset( $elements[ $k ] ) ) { $id = $elements[ $k ]; $hide[] = $id; $hide[] = '#screen-meta label[for=' . substr( $id, 1 ) . '-hide]'; } } $style = implode( ', ', $hide ) . ' {display: none;}'; } /** * Filters the generated CSS styles. * * @date 12/02/2014 * @since 5.0.0 * * @param string $style The CSS styles. * @param array $field_group The field group array. */ return apply_filters( 'acf/get_field_group_style', $style, $field_group ); }