Wordpress中的多个动态边栏
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Wordpress中的多个动态边栏相关的知识,希望对你有一定的参考价值。
To arrange multiple dynamic sidebars in wordpress, add the following code snippet into functions.php. The sidebar should then appear in the dropdown menu in wordpress under the widgets section. Next, go into your sidebar.php file & edit the dynamic sidebar tag by setting conditionals for when certain sidebars can be used in the sidebar.php file.
// use in functions.php: <?php // Multiple Sidebars 'name'=>'Page', 'before_widget' => '<li>', 'after_widget' => '</li>', 'before_title' => '<h2>', 'after_title' => '</h2>', )); 'name'=>'Blog', 'before_widget' => '<li>', 'after_widget' => '</li>', 'before_title' => '<h2>', 'after_title' => '</h2>', )); 'name'=>'Single', 'before_widget' => '<li>', 'after_widget' => '</li>', 'before_title' => '<h2>', 'after_title' => '</h2>', )); } // use in sidebar.php: <?php // Load Dynamic Sidebars showDefault(); } else { if(is_front_page()) { if(!dynamic_sidebar('homepage')) { showDefault(); } } else { if(!dynamic_sidebar('global')) { showDefault(); } } } ?>
以上是关于Wordpress中的多个动态边栏的主要内容,如果未能解决你的问题,请参考以下文章