开发者

how to add dynamic sidebar to a wordpress theme?

开发者 https://www.devze.com 2023-02-02 14:55 出处:网络
I want to add two extra dynamic sidebar to my Wordpress theme above b开发者_如何学Golog posts adjacent to each other, by the way alignment is from right to left, any help is previously appreciated.Can

I want to add two extra dynamic sidebar to my Wordpress theme above b开发者_如何学Golog posts adjacent to each other, by the way alignment is from right to left, any help is previously appreciated.


Can you be a little more specific? Here's how to make your theme widget ready:

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
    ));

Then place this wherever your sidebar will appear:

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

精彩评论

暂无评论...
验证码 换一张
取 消