WordPress函数文档dynamic_sidebar()

调用并显示自定义sidebar侧边栏 描述 This function calls each of the a…

调用并显示自定义sidebar侧边栏

描述

This function calls each of the active widget callbacks in order, which prints the markup for the sidebar. If you have more than one sidebar, you should give this function the name or number of the sidebar you want to print. This function returns true on success and false on failure.

The return value should be used to determine whether to display a static sidebar. This ensures that your theme will look good even when the Widgets plug-in is not active.

If your sidebars were registered by number, they should be retrieved by number. If they had names when you registered them, use their names to retrieve them.

用法

 <?php dynamic_sidebar$index ); ?> 

参数

index

(integer/string) (可选) Name or ID of dynamic sidebar.

默认值: 1

示例

Here is the recommended use of this function:

in the “Twenty Ten” theme (3.0+)

  • wp-content/themes/twentyten/sidebar.php
  • wp-content/themes/twentyten/sidebar-footer.php

源文件

dynamic_sidebar() 函数的代码位于 wp-includes/widgets.php.

相关

Sidebars:
is_active_sidebar(),
is_dynamic_sidebar(),
dynamic_sidebar(),
register_sidebars(),
register_sidebar(),
unregister_sidebar(),
wp_register_sidebar_widget(),
wp_unregister_sidebar_widget(),
wp_get_sidebars_widgets(),
wp_set_sidebars_widgets()

  • 原文:http://codex.wordpress.org/Function_Reference/dynamic_sidebar
类别:WordPress函数文档

本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

评论 (0)COMMENT