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 ...

Get WordPress 3 Plugin Development Essentials now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.