wp_widgets_init() - WordPress 函数参考中文文档

返回介绍

wp_widgets_init()

发布于 2017-09-11 字数 1934 浏览 1036 评论 0

wp_widgets_init()

Registers all of the default WordPress widgets on startup.


描述

Calls ‘widgets_init’ action after all of the WordPress widgets have been registered.


源代码

File: wp-includes/widgets.php

function wp_widgets_init() {
	if ( ! is_blog_installed() ) {
		return;
	}

	register_widget( 'WP_Widget_Pages' );

	register_widget( 'WP_Widget_Calendar' );

	register_widget( 'WP_Widget_Archives' );

	if ( get_option( 'link_manager_enabled' ) ) {
		register_widget( 'WP_Widget_Links' );
	}

	register_widget( 'WP_Widget_Media_Audio' );

	register_widget( 'WP_Widget_Media_Image' );

	register_widget( 'WP_Widget_Media_Video' );

	register_widget( 'WP_Widget_Meta' );

	register_widget( 'WP_Widget_Search' );

	register_widget( 'WP_Widget_Text' );

	register_widget( 'WP_Widget_Categories' );

	register_widget( 'WP_Widget_Recent_Posts' );

	register_widget( 'WP_Widget_Recent_Comments' );

	register_widget( 'WP_Widget_RSS' );

	register_widget( 'WP_Widget_Tag_Cloud' );

	register_widget( 'WP_Nav_Menu_Widget' );

	/**
	 * Fires after all default WordPress widgets have been registered.
	 *
	 * @since 2.2.0
	 */
	do_action( 'widgets_init' );
}

更新日志

Version 描述
2.2.0 Introduced.

相关函数

Uses

  • wp-includes/functions.php:
    is_blog_installed()
  • wp-includes/widgets.php:
    widgets_init
  • wp-includes/plugin.php:
    do_action()
  • wp-includes/option.php:
    get_option()
  • wp-includes/widgets.php:
    register_widget()

User Contributed Notes

上一篇:wp_widgets_add_menu()

下一篇:wp_widget_control()

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!