跳转到主要内容

Plugin API Hooks

A theme should work well with WordPress plugins. Plugins add functionality by using actions and filters, which are collectively called hooks (see Plugin API for more information).

Most hooks are executed internally by WordPress, so your theme does not need special tags for them to work. However, a few hooks need to be included in your theme templates. These hooks are fired by special Template Tags:

wp_head() : Goes at the end of the 

 element of a theme’s header.php template file.

wp_body_open() : Goes at the begining of the

 element of a theme’s header.php template file.

wp_footer() : Goes in footer.php, just before the closing  tag.

wp_meta() : Typically goes in the 

Meta section of a Theme’s menu or sidebar.

comment_form() : Goes in comments.php directly before the file’s closing tag ().

Take a look at a core theme’s templates for examples of how these hooks are used.