$5
Need a quick explanation...
echo '<input type="hidden" name="myplugin_noncename" id="myplugin_noncename" value="' .
wp_create_nonce( plugin_basename(__FILE__) ) . '" />';echo '<label for="myplugin_new_field">' . __("Description for this field", 'myplugin_textdomain' ) . '</label> ';Ok, so these bits were taken from the example provided on:
http://codex.wordpress.org/Function_Reference/add_meta_box
What does "__FILE__" and "__("Description for this field", 'myplugin_textdomain' )" do? What does the "__" do or signify?
UPDATE //
So what is the second parameter ('myplugin_textdomain') of the __() function?
spivurno | 12/19/09 at 11:31am
| Edit
(4) Possible Answers Submitted...
-

Last edited:
12/19/09
1:40pmRon Rennick says:__FILE__ is the full path to the currently executing PHP file.
__ does the same as _e except it returns the translated string instead of echoing it. So, __ translates the string to the current language. -

Last edited:
12/19/09
11:39amBrian Richards says:__("Description for this field", 'myplugin_textdomain' ) is a localization string, helpful for translating. You can learn more about that here: http://blog-en.icanlocalize.com/installing-wordpress-for-multiple-language-blogs/how-to-localize-wordpress-themes-and-plugins-with-gettext/
__FILE__ contains the current file name of the script
Bonus points:
__LINE__ contails the current line number in the script
__PATH__ contains the path to the current script -

Last edited:
12/19/09
1:40pmBrian Richards says:The second parameter of the localization string provides a reference point for translation, as in, what dictionary to use for translating the text.
If supplied, this GetText will return the translations only from the dictionary that you supply with that domain name. Although optional, specifying the translation domain is highly recommended. Without it, GetText might return a different translation, if the same string also appears in a different plugin, or in WordPress. -

Last edited:
12/19/09
1:34pmRon Rennick says:There is a function you can use to register the language files for you plugin. The call looks like this:
load_textdomain( $domain, $mofile )
The domain would match the second parameter in the __( call.
This question has expired.
Current status of this question: Completed





