Jump to content

samdz

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by samdz

  1. Hello, I am working to build my own theme, I learned a lot with (Build a Wordpress Theme from Scratch) but now I have problem to insert 2 sidebars in functions.php I added: ---------------------------------------------------------------------- function mytheme_widgets_init() { register_sidebar( array( 'name' => __( 'sidebar-1', 'mytheme' ), 'id' => 'sidebar-1', 'description' => __( 'sidebarRight', 'mytheme' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); register_sidebar( array( 'name' => __( 'sidebar-2', 'mytheme' ), 'id' => 'sidebar-2', 'description' => __( 'SidebarLeft', 'mytheme' ), 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>', ) ); } add_action( 'widgets_init', 'mytheme_widgets_init' ); -------------------------------------------------------------------- I have: sidebar.php and sadebar2.php sidebar 1 is ok, it's diplayed but sidebar-2 no!!... I added this php code (but I am begginer so I don't know if's correct ) --------------------------------------------------------------------- <?php ?> <?php if ( is_active_sidebar( 'sidebar-2' ) ) : ?> <div id="secondary" class="widget-area" role="complementary"> <?php dynamic_sidebar( 'sidebar-2' ); ?> </div><!-- #secondary --> <?php endif; ?> <?php get_sidebar('sidebar-2'); ?> <div id="sidebar-2"> <ul class="nav"> <li><a href="#">Lien un</a></li> <li><a href="#">Lien deux</a></li> <li><a href="#">Lien trois</a></li> <li><a href="#">Lien quatre</a></li> <?php wp_nav_menu( array('menu' => 'Project Nav', 'container' => '' )); ?> </div> <!-- end .sidebar2 --></div> --------------------------------------------------------------------- I added in index.php and front-page.php <?php get_sidebar(); ?> <?php get_sidebar('sidebar-2'); ?> -------------------------------------------------------------------- Can you help me plz? Sam
×
×
  • Create New...