Wordpress global variables

Source: Internet
Author: User
Tags wordpress version
WordPress global variables can be used for multiple reasons. Almost all data generated by WordPress can be found in global variables. Note that it is better to use the appropriate API function when the global variables are allowed than to directly change them. you need to use global $ variable first; optimize your variables to use global variables. & Nbsp; the internal cycle variable is in the loop

WordPress global variables can be used for multiple reasons. Almost all data generated by WordPress can be found in global variables.

Note that it is better to use the appropriate API function when allowed than to directly change the global variables,

You need to useGlobal $ variable;Compile your variables to use global variables.

 

Internal cycle variable

In a loop, these global variables are set to store information about the page currently being processed.

  • $ Post? The entire post object.
  • $ Authordata? (Object) Returns an object containing information about the author, inserted in the $ post side. The object is described in Function_Reference/get_userdata.
  • $ Currentday? Page release date
  • $ Currentmonth? The month when the page is published.
  • $ Page? (IntThe passed page is specified through the queried variable page.
  • $ Pages? (IntThe number of pages in post, separated by elements.
  • $ Multipage? (Boolean) If post has multiple pages, returnTrue. And$ PageAnd$ PagesRelated.
  • $ More? (Boolean) If multiple pages exist, the returned value isTrue, And$ PageAnd$ PagesRelated
  • $ Numpages? (Int) Returns the total number of pages of The post object.$ PageAnd$ PagesRelated

 

Browser Detection Boolean

If the user uses a browser, the boolean value of the global variable is true.

  • $ 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) Lunix
  • $ Is_IE? (Boolean) Internet Explorer

 

Web server detection Boolean

These global variables store the information of the WordPress server.

  • $ 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 variable
  • $ Wp_version? (String) Installed WordPress version
  • $ Wp_db_version? (Int) Database version
  • $ Tinymce_version? (String) Installed TinyMCE version
  • $ Manifest_version? (String) Cache manifest version
  • $ Required_php_version? (String) PHP version required by WordPress
  • $ Required_mysql_version? (String) MySQL version required by WordPress

 

Miscellaneous
  • $ Wp_query? (Object)? Global instance of the WP_Query class.
  • $ Wp_rewrite? (Object)? WP_Rewrite? Global instance of the class.
  • $ Wp? (Object)? WP? Global instance of the class.
  • $ Wpdb? (Object)? Wpdb? Global instance of the class.
  • $ Wp_locale? (Object)
  • $ Pagenow? (String) In wp-admin
  • $ Allowedposttags? (Array)
  • $ Allowedtags? (Array)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.