acf_get_pretty_post_types()
Хуков нет.
Возвращает
null
. Ничего (null).
Использование
acf_get_pretty_post_types( $post_types );
- $post_types **
- -
По умолчанию: array()
Код acf_get_pretty_post_types() acf get pretty post types ACF 6.0.4
function acf_get_pretty_post_types( $post_types = array() ) { // get post types if ( empty( $post_types ) ) { // get all custom post types $post_types = acf_get_post_types(); } // get labels $ref = array(); $r = array(); foreach ( $post_types as $post_type ) { // vars $label = acf_get_post_type_label( $post_type ); // append to r $r[ $post_type ] = $label; // increase counter if ( ! isset( $ref[ $label ] ) ) { $ref[ $label ] = 0; } $ref[ $label ]++; } // get slugs foreach ( array_keys( $r ) as $i ) { // vars $post_type = $r[ $i ]; if ( $ref[ $post_type ] > 1 ) { $r[ $i ] .= ' (' . $i . ')'; } } // return return $r; }