wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
_get_custom_object_labels is private and should not be used in themes or plugins directly.
_get_custom_object_labels › WordPress Function
Seit3.0.0
Veraltetn/v
› _get_custom_object_labels ( $data_object, $nohier_vs_hier_defaults )
Zugriff: |
|
Parameter: (2) |
|
Gibt zurück: |
|
Definiert in: |
|
Codex: |
Builds an object with custom-something object (post type, taxonomy) labels out of a custom-something object
Ähnliche Funktionen: get_post_type_labels, wp_get_custom_css, get_custom_header, get_taxonomy_labels, wp_get_object_terms
Quellcode
function _get_custom_object_labels( $data_object, $nohier_vs_hier_defaults ) { $data_object->labels = (array) $data_object->labels; if ( isset( $data_object->label ) && empty( $data_object->labels['name'] ) ) { $data_object->labels['name'] = $data_object->label; } if ( ! isset( $data_object->labels['singular_name'] ) && isset( $data_object->labels['name'] ) ) { $data_object->labels['singular_name'] = $data_object->labels['name']; } if ( ! isset( $data_object->labels['name_admin_bar'] ) ) { $data_object->labels['name_admin_bar'] = isset( $data_object->labels['singular_name'] ) ? $data_object->labels['singular_name'] : $data_object->name; } if ( ! isset( $data_object->labels['menu_name'] ) && isset( $data_object->labels['name'] ) ) { $data_object->labels['menu_name'] = $data_object->labels['name']; } if ( ! isset( $data_object->labels['all_items'] ) && isset( $data_object->labels['menu_name'] ) ) { $data_object->labels['all_items'] = $data_object->labels['menu_name']; } if ( ! isset( $data_object->labels['archives'] ) && isset( $data_object->labels['all_items'] ) ) { $data_object->labels['archives'] = $data_object->labels['all_items']; } $defaults = array(); foreach ( $nohier_vs_hier_defaults as $key => $value ) { $defaults[ $key ] = $data_object->hierarchical ? $value[1] : $value[0]; } $labels = array_merge( $defaults, $data_object->labels ); $data_object->labels = (object) $data_object->labels; return (object) $labels; }