Wsparcie » Wtyczki » widzety w różnych miejscach strony.

  • Rozwiązano bogdanc77

    (@bogdanc77)


    Witam !
    Jak w temacie chce mieć widgety w różnych miejscach strony.

    Zrobiłem tak (plik functions.php):

    if ( function_exists('register_sidebar') )
    
    register_sidebar(array(
    		'id' => 'sidebar-1',
    		'name' =>'Footer1',
    		'description' => 'widget1 - footer',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
    		'after_widget' => '</div>',
    		'before_title' => '<h4 class="widgettitle">',
    		'after_title' => '</h4>',
    ));
    
    register_sidebar( array(
    		'id' => 'sidebar-2',
    		'name' => 'Footer2',
    		'description' => 'widget2 - footer',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
    		'after_widget' => "</div>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );
    
    	register_sidebar( array(
    		'id' => 'sidebar-3',
    		'name' =>'Footer3',
    		'description' => 'widget3',
    		'before_widget' => '<div id="%1$s" class="widget %2$s">',
    		'after_widget' => "</div>",
    		'before_title' => '<h3 class="widget-title">',
    		'after_title' => '</h3>',
    	) );

    i tak kolejno pliki sidebar-1.php,sidebar-2.php,sidebar-3.php.

    <div id="sidebar">
    
    <?php      /* Widgetized sidebar, if you have the plugin installed. */
    
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
    
    <div class="widget">
    
    <h3>SideBar1</h3>
    
    <p>Dodaj widzet do paska</p>
    
    </div> <!-- end widget -->
    
    <?php endif; ?>
    
    </div> <!-- end sidebar -->

    Sidebary widac w Panelu Admina i na stronie implementuje je wywołując:

    <?php get_sidebar('1'); ?>
    <?php get_sidebar('2'); ?>
    <?php get_sidebar('3'); ?>

    Gdy nic nie jest dodane to dostaje przykladowy tekst który mam wpisane w plikach sidebar.
    Ale nic poza tym nie dziala.
    Jak przeciagam widget do sidebaru to nic sie nie dzieje.
    Jak dodam do 1 sidebaru to wyswietla mi sie ten sam widget w trzech moich sidebarach na stronie. jak dodam do sidebar 2 lub 3 to nic sie nie dzieje.

    Mam nadzieje ze zrozumiale sie wyrazilem.
    Moze zle cos robie? indeksuje?

Viewing 1 replies (of 1 total)
  • Thread Starter bogdanc77

    (@bogdanc77)

    zapomniałem zmienić w sidebarch id poszczególnego sidebaru:

    <?php if (!function_exists('dynamic_sidebar') || ! dynamic_sidebar( 'sidebar-1' ) ) : ?>

    pozdrawiam

Viewing 1 replies (of 1 total)
  • Temat ‘widzety w różnych miejscach strony.’ jest zamknięty na nowe odpowiedzi.