User Tools

Site Tools


ru:plugins:hooks_filters

This is an old revision of the document!


Хуки и фильтры

Фильтры ядра

add_filter('filter_name','function_to_call');
add_filter('имя_фильтра','имя_привязываемой_функции');
  • content – позволяет изменять содержание переменной $content. Привязываемая функция, которой передается переменная $content, должна возвращать результат в систему.
  • menuitems - позволяет изменять или фильтровать главное меню сайта, формируемое тэгом шаблона get_navigation. Привязываемая функция, которой передается переменная $menu, должна возвращать результат в систему.

Core Hooks

add_action('hook_name','function_to_call',array(arguments));

The last argument is only necessary if function_to_call accepts parameters.

hook_name can be any of these and determines where the function will be called.

FRONT-END HOOKS

  • theme-header Fired in <head> section of theme. Requires get_header() in template
  • theme-footer Fired in the footer of the theme. Requires get_footer() in template
  • content-top Fired right above content area of theme
  • content-bottom Fired right below content area of theme
  • index-pretemplate Called before your template files are rendered
  • index-posttemplate Called after your template files are rendered
  • error-404 Called if the page does not exist, before rendering the error page.

BACK-END HOOKS

  • header Called in the head section of the rendered page
  • header-body Called in the body before output of the page
  • admin-pre-header Called before the header.php template file is loaded (3.1+)
  • footer Called in the footer section of the rendered page
  • common Called immediately after the plugin functions are included in common.php (3.1+)
  • logout Fired when a user logs out
  • index-login Fired above the login form
  • login-reqs Fired on the login sidebar
  • resetpw-success Fired when password reset and successful
  • resetpw-error Fired when password reset and error
  • settings-user Fired before the settings user file is created
  • settings-website Fired before the settings website page is created
  • settings-cpsettings Fired before the settings cp_settings file is created
  • settings-website-extras Fired on the settings page, before “save settings” button in the website section
  • settings-user-extras Fired on the settings page, before “save settings” button in the user section
  • sitemap-additem Allow insertion of a new sitemap XML entry
  • sitemap-save Fired before the sitemap.xml file is saved
  • theme-extras Fired after the theme screenshot
  • theme-edit-extras Fired in the theme edit screen before the submit button
  • welcome-link Allows additional links on the Welcome page
  • welcome-doc-link Allows additional documentation links on the Welcome page
  • healthcheck-extras Allows additional Health-check entries
  • support-extras Allows additional support setting form entries
  • support-save Fired before cp_settings.xml file is created, allows additional support-extras to be saved
  • plugin-hook Fired before the Plugin page is rendered.
  • archive-backup Fired when an archive backup has been created
  • component-save Fired before components are saved
  • component-extras Fired when creating component sections, allows additional form elements to be embedded
  • logfile_delete fired when a logfile is deleted
  • page-delete fired when a page is deleted
  • changedata-save Called just before a page is saved
  • changedata-aftersave Called after a page is saved (3.1+)
  • caching-save Fired before pages.xml file (in data/other) is saved for Caching (3.1+)
  • edit-extras Fired within the Page Options toggle-div within edit.php
  • edit-content Creating additional data/fields after the textarea on edit.php
  • file-uploaded Fired after a file has been successfully uploaded
  • files-extras Fired at the end of the file list
  • successful-login-start
  • successful-login-end

The following actions allow the customization of the administration menu and are described on Tabs and Menus:

  • backups-sidebar, files-sidebar, pages-sidebar, plugins-sidebar, settings-sidebar, support-sidebar, theme-sidebar Allows additional sidebar menu items
  • nav-tab Allow insertion of a new tabbed entry in the navigation bar
ru/plugins/hooks_filters.1381301900.txt.gz · Last modified: 2013/10/09 06:58 by Arkady