Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    May 2010
    Posts
    8
    Thanks
    3
    Thanked 0 Times in 0 Posts

    adding extra wordpress widget sidebar

    i know this mainly deals with php but the php forum seemed to focus more on server sided issues so i decided to post here.

    my site is www.ravegrounds.com and im trying to add a sidebar in the middle where the one recent post is located so the site would become 3 column, 2 of which would be widgetized sidebars.

    i inserted a new sidebar called "middle" based off of the sidebar "primary" that already existed in the file called sidebar-init.php. everything is good at this point because the new menu shows up in my admin area.

    Code:
    <?php
    
    // Register widgetized areas
    
    function the_widgets_init() {
        if ( !function_exists('register_sidebars') )
            return;
    
        register_sidebar(array('name' => 'Primary','id' => 'primary','description' => "Normal full width Sidebar", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '<span>&nbsp;</span></h3>'));
    
        register_sidebar(array('name' => 'Middle','id' => 'middle','description' => "Normal full width Sidebar", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '<span>&nbsp;</span></h3>'));	
    	   
        register_sidebar(array('name' => 'Secondary Left','id' => 'secondary-1', 'description' => "Left column (part of 2-col sidebar)", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '<span>&nbsp;</span></h3>'));
        register_sidebar(array('name' => 'Secondary Right','id' => 'secondary-2', 'description' => "Right column (part of 2-col sidebar)", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '<span>&nbsp;</span></h3>'));	
        register_sidebar(array('name' => 'Footer 1','id' => 'footer-1', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
        register_sidebar(array('name' => 'Footer 2','id' => 'footer-2', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
        register_sidebar(array('name' => 'Footer 3','id' => 'footer-3', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
        register_sidebar(array('name' => 'Footer 4','id' => 'footer-4', 'description' => "Widetized footer", 'before_widget' => '<div id="%1$s" class="widget %2$s">','after_widget' => '</div>','before_title' => '<h3>','after_title' => '</h3>'));
    }
    
    add_action( 'init', 'the_widgets_init' );
    
    
        
    ?>
    then i made a new file called sidebar2.php based off an file that was already there called sidebar.php. the new file looks like this

    Code:
    <div id="sidebar" class="col-right">
    
    	<?php if (is_active_sidebar('middle')) : ?>
        <div class="middle">
    		<?php dynamic_sidebar('middle'); ?>		           
    	</div>        
    	<?php endif; ?>
    
    </div><!-- /#sidebar -->
    every time i post
    Code:
    <?php get_sidebar2(); ?>
    in my index file, all the existing sidebar will disappear on my site. can someone see if i am missing something?
    Last edited by ikidunot; 07-31-2010 at 10:41 AM.

  • #2
    Regular Coder
    Join Date
    Aug 2005
    Location
    MS
    Posts
    851
    Thanks
    11
    Thanked 79 Times in 77 Posts
    Might help:

    Managing Plugins: http://codex.wordpress.org/Managing_Plugins

    Plugins can extend WordPress: http://wordpress.org/extend/plugins/

    33 Wordpress Plugins To Power Up Your Comment Section: http://www.1stwebdesigner.com/wordpr...mment-section/
    ☠ ☠RON☠ ☠


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •