• Hi every body, i’ve got page ‘theme-sidebars’:

    <?php
    add_action( 'widgets_init', 'deco_sidebar' );
    
    function deco_sidebar() {
    	register_sidebar(
    		array(
    			'id'            => 'deco_sidebar',
    			'name'          => __( 'Правый сайдбар' ),
    			'description'   => __( 'Виджет для правой колонки на сайте' ),
    			'before_widget' => '<div class="popular-small cf" style="font-size:16px;">',
    			'after_widget'  => '</div>',
    			'before_title'  => '<a href="#">',
    			'after_title'   => '</a>'
    		)
    	);
    }
    
    dynamic_sidebar( 'deco_sidebar' );

    how to display this sidebar in one of my page, pls explain somebody)

Viewing 5 replies - 1 through 5 (of 5 total)
  • Place this part in functions.php

    add_action( 'widgets_init', 'deco_sidebar' );
    
    function deco_sidebar() {
    	register_sidebar(
    		array(
    			'id'            => 'deco_sidebar',
    			'name'          => __( 'Правый сайдбар' ),
    			'description'   => __( 'Виджет для правой колонки на сайте' ),
    			'before_widget' => '<div class="popular-small cf" style="font-size:16px;">',
    			'after_widget'  => '</div>',
    			'before_title'  => '<a href="#">',
    			'after_title'   => '</a>'
    		)
    	);
    }

    and second part

    dynamic_sidebar( 'deco_sidebar' );

    where you want to display the widget area.

    For second part better code will be

    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('deco_sidebar') ) : 
    
    endif; ?>
    Thread Starter Wahtel

    (@wahtel)

    Thanks!
    Can you explain one more thing, how create widgets, this is a simple php file, which is filled content using wp_query?
    Or it got own syntax which will display this widgets in the admin panel?

    For creating Widgets you can check this Codex page.
    Widgets API

    Its code depends upon what you want to do with Widgets.But basic skeleton is shown in above link.

    Thanks

    Thread Starter Wahtel

    (@wahtel)

    Thnaks my friend)

    You are welcome. 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘how to display sidebar?’ is closed to new replies.