You appear to be a bot. Output may be restricted
Description
Attempt to set labels given the 'name' and/or 'singular_name'When the singular_name is not just the name without the last 's' then you need to set the singular_name yourself OR let the Porter Stemmer algorithm come up with a solution.
Usage
$array = bw_default_labels( $labels );
Parameters
- $labels
- ( array ) optional – subset of the total set
Returns
array hopefully all of the required labelsSource
File name: oik/includes/bw_register.phpLines:
1 to 49 of 49
function bw_default_labels( $labels= array() ) { $ucplural = bw_array_get( $labels, 'name', null ); if ( !$ucplural ) { $ucplural = __( 'Posts', "oik" ); } else { $ucplural = bw_ucfirst( $ucplural ); } $lcplural = strtolower( $ucplural ); $labels['name'] = bw_array_get( $labels, 'name', $ucplural ); $labels['menu_name'] = bw_array_get( $labels, 'menu_name', $ucplural ); $ucsingular = bw_array_get( $labels, 'singular_name', null ); if ( !$ucsingular ) { $ucsingular = bw_singularize( $ucplural ); } $labels['singular_name'] = $ucsingular; /* translators: %s: post type label plural capitalised */ $labels['all_items'] = bw_array_get( $labels, 'all_items', sprintf( __( 'All %1$s', "oik" ), $ucplural ) ); /* translators: %s: post type label singular capitalised */ $labels['add_new'] = bw_array_get( $labels, 'add_new', sprintf( __( 'New %1$s', "oik" ), $ucsingular ) ); /* translators: %s: post type label singular capitalised */ $labels['add_new_item'] = bw_array_get( $labels, 'add_new_item', sprintf( __( 'Create New %1$s', "oik" ), $ucsingular ) ); $labels['edit'] = bw_array_get( $labels, 'edit', __( 'Edit', "oik" ) ); /* translators: %s: post type label singular capitalised */ $labels['edit_item'] = bw_array_get( $labels, 'edit_item', sprintf( __( 'Edit %1$s', "oik" ), $ucsingular ) ); /* translators: %s: post type label singular capitalised */ $labels['new_item'] = bw_array_get( $labels, 'new_item', sprintf( __( 'New %1$s', "oik" ), $ucsingular ) ); /* translators: %s: post type label singular capitalised */ $labels['view'] = bw_array_get( $labels, 'view', sprintf( __( 'View %1$s', "oik"), $ucsingular ) ); $labels['view_item'] = bw_array_get( $labels, 'view_item', sprintf( __( 'View %1$s', "oik" ), $ucsingular ) ); $labels['search_items'] = bw_array_get( $labels, 'search_items', sprintf( __( 'View %1$s', "oik" ), $ucplural ) ); /* translators: %s: post type label plural */ $labels['not_found'] = bw_array_get( $labels, 'not_found', sprintf( __( 'No %1$s found', "oik" ), $lcplural ) ); /* translators: %s: post type label plural */ $labels['not_found_in_trash'] = bw_array_get( $labels, 'not_found_in_trash', sprintf( __( 'No %1$s found in Trash', "oik") , $lcplural ) ); // These labels were added in WordPress 4.3.0 $labels['featured_image'] = bw_array_get( $labels, 'featured_image', __( 'Featured Image', "oik" ) ); $labels['set_featured_image'] = bw_array_get( $labels, 'set_featured_image', __( 'Set featured image', "oik" ) ); $labels['remove_featured_image'] = bw_array_get( $labels, 'remove_featured_image', __( 'Remove featured image', "oik" ) ); $labels['use_featured_image'] = bw_array_get( $labels, 'use_featured_image', __( 'Use as featured image', "oik" ) ); // These labels were added in WordPress 5.8 /* translators: %s: post type label singular capitalised */ $labels['item_link'] = bw_array_get( $labels, 'item_link', sprintf( __( '%1$s Link', "oik"), $ucsingular ) ); /* translators: %s: post type label singular capitalised */ $labels['item_link_description'] = bw_array_get( $labels, 'item_link_description', sprintf( __( 'Link to %1$s', "oik"), $ucsingular ) ); // should each array element now be translated? bw_trace2( $labels, "labels", true, BW_TRACE_VERBOSE ); return( $labels ); }View on GitHub View on Trac