O'Reilly logo

WordPress 3 Plugin Development Essentials by Everett Griffiths, Brian Bondari

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

WordPress Functions

The following are a number of functions within WordPress that we utilized, with examples.

__

string __( string $text [, string $domain ])

Retrieves the translated string into the current locale. The $domain is "default" by default, but when authoring your own plugin, you should define your own text domain.

Example:

print __('Hello', 'my_text_domain'); // Might print "Hola" in a Spanish speaking locale.

_e

_e( $text, $domain )

Prints the translated string into the current locale. The result is the same as if you had done:

echo __('your-string');

add_action

add_action( $event, $function_to_add, $priority, $accepted_args );

Hooks an action event to a user-defined callback function; normally, no values are returned from these callback ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required