如何在wordpress主题中添加动态侧边栏?

the*_*mer 3 wordpress wordpress-theming wordpress-plugin

我想在我的Wordpress主题上面添加两个额外的动态侧边栏,在彼此相邻的博客文章之上,顺便说一下从右到左的方式,任何帮助都是先前赞赏的.

Jar*_*red 7

你能更具体一点吗?以下是如何使主题小部件准备就绪:

的functions.php

// register sidebars
if ( function_exists('register_sidebar') )
    if ( function_exists('register_sidebar') )
        register_sidebar(array('name'=>'Left Sidebar', //Name your sidebar
        'description' => 'These widgets will appear in the left sidebar.',
        'before_widget' => '<div class="widget">', // Displays before widget
        'after_widget' => '</div>', // Displayed after widget
        'before_title' => '<h3>', //Displays before title, after widget start
        'after_title' => '</h3>' //Displays after title
    ));
Run Code Online (Sandbox Code Playgroud)

然后将它放在侧栏出现的任何位置:

<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar Name Here') ) : ?>
    <!-- static content goes here if sidebar is inactive -->
<?php endif; ?>
Run Code Online (Sandbox Code Playgroud)