php - "__(" in custom post types -


i'm building custom post types wordpress project, not understand why in examples on internet it's possbile find this:

register_post_type('omb_prodotti',     array(       'labels' => array(         'name' => __( 'customposttype' ),         'singular_name' => __( 'customposttype' )       ) 

what "__(" used for? related translations? wouldn't possible write instead:

register_post_type('omb_prodotti',     array(       'labels' => array(         'name' => 'customposttype',         'singular_name' => 'customposttype'       ) 

sorry i'm beginner in both php , building custom wp themes.

thank much.

it's impossible search __ in search engine wordpress double underscore found answer in wordpress documentation:

description

retrieves translated string translate().

usage

<?php $translated_text = __( $text, $domain ); ?>

source.

as wrote, function translate content. question, if don't call __() function string won't translated, display customposttype. __('customposttype'), load translation instead, relevant string. have @ code find corresponding string.


Comments

Post a Comment

Popular posts from this blog

java - Suppress Jboss version details from HTTP error response -

gridview - Yii2 DataPorivider $totalSum for a column -

Sass watch command compiles .scss files before full sftp upload -