专注网络营销推广SEM,搜索引擎优化及WordPress网站建设

wordpress做网站参考手册之常用函数

2 312

WordPress定义了许多有用的PHP函数。一些函数,称为模板标记,是指特别是用于WordPress的主题。还有一些函数相关的行动和过滤器(插件的API ) ,因而主要用于开发插件。其余的都是用来建立核心WordPress的功能。

许多核心WordPress的功能是有用的插件和主题开发。因此,本文列出了大部分的核心函数,但不包括模板标记。在页面的底部,有一节列出其他资源的调查 了解WordPress的函数。

注:本参考适用于版本2.1和更高版本的WordPress的。

Post, Page, Attachment and Bookmarks Functions
Posts

Post insertion/removal

Pages

Custom field (postmeta)

Attachments

Bookmarks

Others

Category, Tag and Taxonomy Functions
Categories

Category Creation

Tags

Taxonomy

User and Author Functions
Users and Authors

User meta

User insertion/removal

Login / Logout

Feed Functions
Comment, Ping, and Trackback Functions
Action, Filter, and Plugin Functions
Filters

Actions

Plugins

Shortcodes

Theme-Related Functions
Include functions

Other functions

Formatting Functions
Miscellaneous Functions
Time/Date Functions

Serialization

Options

XMLRPC

Localization

Cron (Scheduling)

Miscellaneous

Classes
The following classes were created by WordPress developers, and are found in files capabilities.php, classes.php, class-snoopy.php, locale.php, query.php, rewrite.php, script-loader.php, wp-db.php:

  • WP – general request handling
  • WP_Ajax_Response – AJAX handling
  • WP_Object_Cache (formerly WP_Cache) – Object cache (and functions wp_cache_add, wp_cache_close, wp_cache_delete, wp_cache_flush, wp_cache_get, wp_cache_init, wp_cache_replace, wp_cache_set)
  • WP_Error – error handling (and function is_wp_error)
  • WP_Locale – handles date and time locales
  • WP_Query – Request parsing and manipulation, posts fetching (with functions get_query_var, query_posts, have_posts, in_the_loop, rewind_posts, the_post, wp_old_slug_redirect, setup_postdata, as well as the Conditional Tags is_*)
  • WP_Rewrite – Rewrite rules (and functions add_rewrite_rule, add_rewrite_tag, add_feed, add_rewrite_endpoint, url_to_postid)
  • WP_Roles, WP_Role, WP_User – Users and capabilitiesmap_meta_cap, current_user_can, get_role, add_role, remove_role
  • WP_Scripts – JavaScript loading (and functions wp_print_scripts, wp_register_script, wp_deregister_script wp_enqueue_script)
  • WP_Styles – CSS stylesheet loading (and functions wp_print_styles, wp_register_style, wp_deregister_style, wp_enqueue_style )
  • Display tree-like data – Walker, Walker_Page, Walker_PageDropdown, Walker_Category, Walker_CategoryDropdown
  • wpdb – Database interface

The following classes were created by outside developers, and are found in files class-IXR.php, class-pop3.php, class-snoopy.php, gettext.php, rss.php, streams.php:

  • IXR – XML-RPC Classes, including IXR_Value, IXR_Message, IXR_Server, IXR_IntrospectionServer, IXR_Request, IXR_Client, IXR_ClientMulticall, IXR_Error, IXR_Date, IXR_Base64
  • Snoopy – HTTP client
  • gettext_reader (part of PHP-gettext) – Localization Class
  • RSS Classes (MagpieRSS and RSSCache) (and functions fetch_rss, is_info, is_success, is_redirect, is_error, is_client_error, is_server_error, parse_w3cdtf, wp_rss, get_rss)
  • POP3: SquirrelMail wrapper
  • StreamReader, StringReader, FileReader, CachedFileReader
2条评论
  1. Alexandra 评论

    I told my kids we’d play after I found what I nedeed. Damnit.

  2. Pepper 评论

    Superb blog! Do you have any helpful hints for aspiring writers? Thanks!

发表评论

您的电子邮件地址将不会发布。