wp全域變數

來源:互聯網
上載者:User

標籤:des   http   os   使用   io   for   資料   ar   cti   

簡介

使用WordPress全域變數有多種原因。幾乎所有WordPress產生的資料都可以在全域變數中找到。

請注意,與直接更改全域變數相比,在情況允許的條件下使用恰當的API功能會更好一點,

你需要先使用global $variable;全域化你的變數,以便能夠使用全域變數。

"不推薦使用除以下列表之外的全域變數"

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 (array)The content pages within a post, which were separated by <!--nextpage--> 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
  • $super_admins (array) An array of user IDs that should be granted super admin privileges (multisite). This global is only set by the site owner (e.g., in wp-config.php), and contains an array of IDs of users who should have super admin privileges. If set it will override the list of super admins in the database.

  • $wp_query (object) The global instance of the Class_Reference/WP_Query class.

  • $wp_rewrite (object) The global instance of the Class_Reference/WP_Rewrite class.

  • $wp (object) The global instance of the Class_Reference/WP class.

  • $wpdb (object) The global instance of the Class_Reference/wpdb class.

  • $wp_locale (object)

  • $wp_admin_bar (WP_Admin_Bar)

  • $wp_roles (WP_Roles)

  • $wp_meta_boxes (object) Object containing all registered metaboxes, including their id‘s, args, callback functions and title for all post types including custom.

Admin Globals
  • $pagenow (string) used in wp-admin See also get_current_screen() for the WordPress Admin Screen API

  • $post_type (string) used in wp-admin

  • $allowedposttags (array)

  • $allowedtags (array)

  • $menu (array)


wp全域變數

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.