Wordpress Discussion
Out of context: Reply #120
- Started
- Last post
- 164 Responses
- dee-dubs0
this is probably a really dumb question... i seen quite a few code snippets of things being registered within functions where they have a random var a the end of each array which is the same for all entires..ie
// Add new taxonomy, NOT hierarchical (like tags)
$labels = array(
'name'=> _x( 'Writers', 'taxonomy general name', 'textdomain' ),
'singular_name'=> _x( 'Writer', 'taxonomy singular name', 'textdomain' ),etc (textdomain)
and
array('labels' => array(
'name' => __('Custom Types', 'jointswp'), /* This is the Title of the Group */
'singular_name' => __('Custom Post', 'jointswp'), /* This is the individual type */
'all_items' => __('All Custom Posts', 'jointswp'), /* the all items menu item */
'add_new' => __('Add New', 'jointswp'), /* The add new menu item */
etc('jointswp')Is this just some arbitrary thing for grouping or what.. Have seen these functions where they also not used but cant work out what they'd be for
not important, just curious.
- last argument is the domain it's just used to retrieve the variable (if you leave it the domain is 'default').kingsteven
- second arg for _x is the context for the translation. you'd only see that on big plugins/ themes with language packs pretty fucking niche.kingsteven
- documentation for the double underscore function here... https://developer.wo…kingsteven
- ah, was assuming wasn't essential but that explains itdee-dubs