How to activate sidebar in Directory plugin and its default theme?

I want to put a wp chat plugin (quick chat) on the right side of the main container area. I'm using your Directory plugin.
http://www.rehabfinder.info

The chat can be used as a widget, but your theme that comes with Directory plugin has only 4 footer widgets. I'd like to enable sidebar, so I can have quick-chat and some other plugins displayed o nthe right side of the main container.

How do I enable sidebar and sidebar widgets?

Thanks

  • beau_griffis
    • Site Builder, Child of Zeus

    Thanks, I added this line
    <?php get_sidebar(); ?>

    above the

    <?php get_footer(); ?>

    In the Main Index Template (index.php) and upon inspection of the newly rendered code in browser (with firebug) there is no div sidebar in the html source.

    Any advices?

  • beau_griffis
    • Site Builder, Child of Zeus

    This is my sidebar.php content. Does anything needs to be changed to make it appear on the page? Is there a switch in the WP gui that I need to turn on or activate?

    <div id="sidebar"><!-- start #sidebar -->
    <div class="padder">

    <?php if ( is_active_sidebar( 'sidebar-default' ) ) : ?>
    <?php dynamic_sidebar( 'sidebar-default' ); ?>
    <?php endif; ?>

    </div>
    </div><!-- end #sidebar -->

  • Kimberly
    • Champion of Loops

    Beau I will have to go in and see about adding this, it was never included in the original so it will need to be added. Feel free to google, how to add sidebar to theme and take a whack at it, as that's what will likely happen when I get to it :slight_smile:

    Seems if the <?php get_sidebar()' ?> is not working then the sidebar will need to be registered.

  • beau_griffis
    • Site Builder, Child of Zeus

    Ok, on this link:

    http://www.blogohblog.com/adding-extra-sidebar-to-your-wordpress-theme/

    I have found instructions to enter the following line of code in the functions.php

    if ( function_exists('register_sidebars') )
    register_sidebars(2);
    ?>

    The tutorial is about adding more sidebars, hence it has register_sidebars(2).
    The code as I enterd it in functions.php is:

    if ( function_exists('register_sidebars') )
    register_sidebars(1);
    ?>

    As i need only one.

    After updating the functions.oho, the sidebar is now displaying in the widgets area, but I don't see any sidebar divs created in html.

    Got any advice?

  • beau_griffis
    • Site Builder, Child of Zeus

    Hi, thanks for your help.

    >do you have the get sidebar function in the page template?

    If by page template you mean Main Index Template (index.php),
    the code in there is (without stars)

    *******************
    <?php get_header() ?>

    <div id="content"><!-- start #content -->

    <div class="padder">
    <div class="page" id="blog-latest"><!-- start #blog-latest -->

    <?php if ( have_posts() ) : ?>
    <?php locate_template( array( '/loops/loop-excerpt.php' ), true ); ?>
    <?php locate_template( array( '/components/pagination.php' ), true ); ?>
    <?php else : ?>
    <?php locate_template( array( '/components/messages.php' ), true ); ?>
    <?php endif; ?>

    </div><!-- end #blog-latest-->
    </div>
    </div><!-- end #content -->
    <?php get_sidebar(); ?>
    <?php get_footer() ?>
    *******************

    As you have advides me earlier, I have added the line

    <?php get_sidebar(); ?>

    Above the

    <?php get_footer() ?>

    >did you complete the step for adding to the index.php?
    If you are referring to the steps outlined in the:
    http://www.blogohblog.com/adding-extra-sidebar-to-your-wordpress-theme/

    No, I haven't. That is because I can only (for whatever reason that is) ONLY see this piece of code on that page:

    if ( function_exists('register_sidebars') )
    register_sidebars(2);
    ?>

    I can see that there are few other blueish boxes and it says above them "Then jsut put this code in this and that location, but there is no code in the box.

    I'll try the (new) tutorial you suggested.

  • beau_griffis
    • Site Builder, Child of Zeus

    I tried the tutorial at http://www.tastyplacement.com/add-sidebar-wordpress

    but it's not working. The home-page sidebar (created through the tutorial) does appear in the widgets area, but whatever widget I insert into it is not displaying on the live page.

    I have called for the home-page sidebar in Main Index Template (inex.php) just above the get_footer, with (as it states in tutorial:

    <?php get_sidebar('homepage'); ?>

    No hompage sidebars appearing on the page or in the html code.

  • Paul
    • The Green Incsub

    @beau_griffis, I really just need the theme. Or where ever you have made modifications to the code. At this point I don't know what you have tried.

    You can't upload the zip file. Can you upload to Dropbox or some file share system where I can download it?

  • Paul
    • The Green Incsub

    @beau_griffis, Ok. I've made some modifications to the default that which comes with Directory.

    Refer to the image attached to this post to see how the right sidebar is implements. I was not sure on what page you wanted the sidebar. As I'm sure you are aware this can go to home, Page, Post, Archives, etc. I chose just Page. If you want this on other page you will need to modify the code as needed.

    Theme files changed:

    functions.php: I've added a new function to the base file. This new function simply registers a new sidebar named 'Page Right Sidebar'

    footer.php: As part of the page structure there is an outer div with ID of 'container' which wraps all the page output. The closing part of that div is in the footer. It is after that closing div I added the call to pull in the dynamic sidebar. You should see the following code in footer.php. Note you will need to change the IF is_page logic to display the sidebar on other sections of the site. Like is_home, is_front_page, etc.

    /* Custom code to show the right sodebar */
    if (is_page()) {
    	?><div id=&quot;custom-page-right-sidebar&quot;><ul class=&quot;widgets&quot;><?php dynamic_sidebar('page-right-sidebar-widget'); ?></ul></div><?php
    }

    css/layout.css: By default the page content is full width. So I had to add some CSS so that on a Page where we are displaying the right sidebar we set the content width to 620px and the sidebar with to 300px. Look at the bottom of the layout.css file to see the CSS rules I've defined. Adjust these as needed. Also note the body.page context. This means the CSS will ONLY effect Pages.

    body.page #container {
    float: left;
    width: 620px;
    margin-right: 20px;
    }

    body.page #custom-page-right-sidebar {
    width: 300px;
    float: left;
    padding: 10px 0;
    }

    You can download the full theme via the following link
    https://dl.dropbox.com/u/2616987/WPMUDev/default-custom.zip

  • beau_griffis
    • Site Builder, Child of Zeus

    Hi Paul, your tweaks worked like charm, except that I'm getting weird order of widget placement. Look at scrshot. (Sidebar being at the bottom, and I want it just below the Advertisement)

    It's not a major issue, but if there is a quick way to have "Sidebar widget placement" just below the "Advertisement widget placement" that would be awesome.

    I'm thinking that the order of those, affects the position of widgets on the website, right?

  • Paul
    • The Green Incsub

    @beau_griffis, This screenshot is from your wp-admin Appearance > Widgets page, correct. The reason these are order in this manor is because the Directory theme code is executed first and creates the first set of sidebars Advertisement, First Footer, Second Footer, etc.

    The code I provided runs second to the core Directory theme setup. That is why you see the new sidebar 'Page Right Sidebar' at the bottom.

    The display of the sidebars in the Widgets ares does not effect the order of display on the front-end of your site. Because in the theme code each sidebar is being referenced directly by name.

    So if you really want the sidebars listing to be in your specific orders. Here are two quick changes.

    1. In the functions.php file I provided I added a line like the following
    add_action( 'widgets_init', 'custom_register_sidebars' );

    Comment the line out with double '//' at the beginning of the line. This will prevent this action from being called.

    2. A few lines below this action you will see the 'register_sidebar(...) You want to copy this set of code and add it to another file where the other sidebars are being registered. That file is core/core.php If you look around line 51 you will see the other functions register_sidebars() where each of the theme sidebars are created. So copy the register_sidebar() from the functions.php into the core/core.php file in the position you want it displayed.

    Hope this helps. It you need me to provided the above changes in a new theme zip file let me know.

  • beau_griffis
    • Site Builder, Child of Zeus

    This was an old post but what happened was that i updated the theme, I still got your old code but theres no sidebar active now. Is there anyway to reenact this?

    Thanks Guys
    You've Been Very Helpful This Whole Time.
    I really appreciate it.

  • tony_burgos
    • WPMU DEV Initiate

    Hi guys, sorry to interrupt, but I can confirm that this is still an ongoing issue...
    Directory plugin default theme only shows Advertisement + 4 Footer Widgets, it doesn't show "Sidebar" widget area.
    It would be nice if the theme was updated to display a sidebar.
    Thanks,

    TB

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.