Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am studying twenty_eleven theme and have some quesions.

What is

 * @package WordPress
 * @subpackage Twenty_Eleven
 * @since Twenty Eleven 1.0
 */

What is the use of @ mean. And again.

 * @uses load_theme_textdomain() For translation/localization support.
 * @uses add_editor_style() To style the visual editor.
 * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers
 *  and backgrounds, and post formats.
 * @uses register_nav_menus() To add support for navigation menus.
 * @uses register_default_headers() To register the default custom header images provided with the theme.
 * @uses set_post_thumbnail_size() To set a custom post thumbnail size.
 *
 * @since Twenty Eleven 1.0
 */
share|improve this question

2 Answers 2

up vote 5 down vote accepted

The @ in header comments is the PHP Documentor meta data style.

This syntax allow you to specify different kind of information:

  • package and subpackage with @package and @subpackage allow you to define what is the context for the current file (used for PHP 5.3 namespaces like in the Java syntax)
  • author with @author, copyright with @copyright and licence with @licence to specify how can be used the given source code
  • description with @description and version with @version to follow library details
  • deprecated with @deprecated to prevent API modifications

Here the PHP Documentor reference: http://www.phpdoc.org/docs/latest/for-users/phpdoc-reference.html

These comments are also used by wordpress to extract and import meta data as you can see in the style.css file of your studied theme but it's not the same syntax (only labels and colon without @)

share|improve this answer
    
thank you! I tought it was pulling in packages, like as3... –  user31344 Aug 6 '13 at 17:24
    
You're welcome! Wordpress work with PHP 5.2 compatibility and PHP does not support packages in this version... If you are interested in PHP with packages and familiar with AS3 package structure take a look at namespaces: php.net/manual/en/language.namespaces.php –  shulard Aug 13 '13 at 9:43

The @ symbol in the lines you are looking at are phpdoc tags.

Each of the lines you are looking at are enclosed in PHP comments, which means they are not executed as PHP code. However, WordPress uses a documentation system called PHPDoc, which is documentation embedded into the PHP files as comments. PHPDoc uses these @tags to provide relationships between functions.

For example, here is the documentation for TwentyEleven's functions.php file in WordPress 3.6: https://xref.wordpress.org/tags/3.6/WordPress/Twenty_Eleven/_wp-content---themes---twentyeleven---functions.php.html

The entire page is taken from the comments in the functions.php file. If you scroll down to the twentyeleven_setup function, you'll see that each of the @uses lines provides a link to the documentation of another function.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.