2
A
回答
-3
1
只需使用* the_widget()*功能搜索:
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar() && !is_active_sidebar('your-example-widget-area')) {
echo '<div>';
the_widget(
'WP_Widget_Text'
,array(
'title' => 'example title'
,'text' => '
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Aenean et quam a ante sodales feugiat. Aliquam et vulputate turpis.
Mauris quis sodales neque. Sed vestibulum faucibus eros nec tincidunt.
Integer tortor magna, suscipit vitae ultricies vel, vehicula sit amet sapien.
</p>
'
,'filter' => ''
)
,array(
'before_widget' => '<div class="widget-container">'
,'after_widget' => '</div>'
,'before_title' => '<h3 class="widget-title">'
,'after_title' => '</h3>'
)
);
echo '</div>'; } elseif(is_active_sidebar('your-example-widget-area')) {
echo '<div>';
dynamic_sidebar('your-example-widget-area');
echo '</div>'; } // endif;
。希望帮助。 (Sry,对于奇怪的elseif位置,格式化错误此刻)
相关问题
- 1. Android小工具和布局默认值
- 2. WordPress的3.5.1:限制默认搜索小工具在特定类别上搜索
- 3. WordPress的小工具问题
- 4. 删除Wordpress中的默认小部件
- 5. WordPress更改默认缩略图大小
- 6. Wordpress小工具&符问题
- 7. PyGtk,有像RadioButton默认选择的小工具
- 8. 默认永久wordpress
- 9. 如何默认小工具添加到自定义动态栏
- 10. 添加工具栏项目上默认的工具栏
- 11. WordPress的小工具窗体功能
- 12. WordPress的小工具不保存
- 13. Wordpress中的小工具数量限制
- 14. WordPress的小工具重定向页面
- 15. WordPress的小工具自动激活
- 16. WordPress的小工具不显示在(AdminPanel)
- 17. WordPress的文本模块(小工具)
- 18. WordPress的默认标志
- 19. 默认大小
- 20. 自定义补充工具栏上的WordPress文本小工具
- 21. IE工具栏默认显示
- 22. 折叠工具栏默认折叠
- 23. 使CKEditor工具箱默认打开
- 24. Git diff工具重置为git默认
- 25. 默认平台工具,在Visual Studio
- 26. 禁用默认工具提示
- 27. Android.mk - 默认使用哪些工具链?
- 28. 样式默认验证工具提示
- 29. 拖放后Wordpress小工具消失
- 30. 显示小工具外侧 - WORDPRESS
btw:这段代码让shure知道wp函数dynamic_sidebar存在,所以它也是向后兼容的。 – kaiser 2010-12-16 02:37:08