Adding extra sidebars…
-
I would have added this to the thread it relates to, howver someone decided to close it :-/
Anyway, although WP has gotten a little more advanced as of late it’s still possible to add extra sidebars by manually adding code to files, and the code I’ll be referring to is sitting inside this thread.
At the time I was adding it a theme that used a block of colour for the footer, so there were no issues with its extensibility, however my most recent project is using a theme that has an image file as the background of the footer, and I quickly discovered that adding the above code didn’t really produce a functional footer bar. And today it hit me, what about taking the code I’d put into the “footer.php” and adding it to the other files – index.php, page.php and single.php?
So I tried it and…well see for yourself (it works! ?? ). You’ll notice that if you click on any page, or a post or even a category or archive page that there’s a nifty footer bar working away at the bottom of each of them.
So – if you place the code intended for the “footer.php” (using the code from the post above) in between the “<?php get_sidebar(); ?>” and “<?php get_footer(); ?>” lines of the 3 files, your new footer bar should still work perfectly. In my example the code looks like:
<?php get_sidebar(); ?> <div id="subfooter"> <div class="FooterLeft"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('FooterLeft') ) : ?> <?php endif; ?> </div> <div class="FooterCenter"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('FooterCenter') ) : ?> <?php endif; ?> </div> <div class="FooterRight"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('FooterRight') ) : ?> <?php endif; ?> </div> <div class="FooterExtremeRight"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('FooterExtremeRight') ) : ?> <?php endif; ?> </div> </div> <?php get_footer(); ?>
Theoretically, the base code could then be adapted and used to create an infinite number of extra sidebars allowing for a much more flexible design for those who are making a site heavily reliant on widgets. I haven’t tried this theoretical part so no guarantees though… ??
- The topic ‘Adding extra sidebars…’ is closed to new replies.