Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

User:Jipsou/fr:Global Variables

(

Page d'accueil du Codex en français - Télécharger WordPress en français
Les utilisateurs francophones se retrouvent sur le site WordPress-Francophone, notamment sur son forum d'entraide.

) (
This page is marked as incomplete. You can help Codex by expanding it.
)

Présentation

Les variables globales spécifiques à Wordpress sont utilisées dans le code de Wordpress pour différentes raisons. Pratiquement toutes les données générées par Wordpress peuvent être touvées dans les variables gobales.

Gardez à l'esprit qu'il est préférable d'utiliser les fonctions API appropriées plutôt que de modifier directement les globales.

Pour accéder à une Variable Globale dans votre code, il vous faut tout d'abord To access a global variable in your code, you first need to globalize the variable with global $variable;

Accessing other globals besides the ones listed below is not recommended.

Inside the Loop variables

While inside the loop, these globals are set, containing information about the current post being processed.

  • $post The whole post object.
  • $authordata (object) Returns an object with information about the author, set alongside the last $post. Object described in Function_Reference/get_userdata.
  • $currentday Day of the post.
  • $currentmonth Month of the post.
  • $page (int) The page of the post, as specified by the query var page.
  • $pages (int)The number of pages within a post, which are separated by elements.
  • $multipage (boolean)Returns true if the post has multiple pages, related to $page and $pages.
  • $more (boolean) Returns true if there are multiple pages in the post, related to $page and $pages.
  • $numpages (int) Returns the number of pages in the post, related to $page and $pages.

Browser Detection Booleans

These globals store data about which browser the user is on.

  • $is_iphone (boolean) iPhone Safari
  • $is_chrome (boolean) Google Chrome
  • $is_safari (boolean) Safari
  • $is_NS4 (boolean) Netscape 4
  • $is_opera (boolean) Opera
  • $is_macIE (boolean) Mac Internet Explorer
  • $is_winIE (boolean) Windows Internet Explorer
  • $is_gecko (boolean) FireFox
  • $is_lynx (boolean)
  • $is_IE (boolean) Internet Explorer

Web Server Detection Booleans

These globals store data about which web server WordPress is running on.

  • $is_apache (boolean) Apache HTTP Server
  • $is_IIS (boolean) Microsoft Internet Information Services (IIS)
  • $is_iis7 (boolean) Microsoft Internet Information Services (IIS) v7.x

Version Variables

  • $wp_version (string) The installed version of WordPress
  • $wp_db_version (int) The version number of the database
  • $tinymce_version (string) The installed version of TinyMCE
  • $manifest_version (string) The cache manifest version
  • $required_php_version (string) The version of PHP this install of WordPress requires
  • $required_mysql_version (string) The version of MySQL this install of WordPress requires

Misc