How to add a dynamic sidebar to a wordpress theme?

I want to add two additional dynamic sidebars to my Wordpress theme above blog posts adjacent to each other, while right-to-left alignment, any help has been previously evaluated.

+3
source share
1 answer

Can you be 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 put 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; ?>
+7
source

Source: https://habr.com/ru/post/1783857/


All Articles