Support » Fixing WordPress » Help with formatting functions.php for dynamic sidebar

  • Resolved ashleymurphy

    (@ashleymurphy)


    Hello,

    I’ve tried to create dynamic sidebars so that my client can edit them through the widgets panel. Here is the code I’m using in my functions.php. It is supposed to create three separate dynamic sidebars.

    <?php
    if(function_exists(‘register_sidebar’)){
    register_sidebar(array(‘name’ => ‘Process Sidebar’));
    }
    register_sidebar(array(‘name’=>’Contact Sidebar’));
    }
    register_sidebar(array(‘name’=>’Services Sidebar’));
    ?>

    And here is what I am using in the sidebar-services.php for example

    <div id=”rightCol-custom”>

      <?php if ( !function_exists(‘dynamic_sidebar’)
      || !dynamic_sidebar(‘Services Sidebar’) ) : ?>
      <?php endif; ?>

    <!– end of left sidebar–>
    </div>

    My problem is this: When I just have the first two sidebars in the functions.php it works but when I add the function for the third sidebar “Services” then the whole site crashes and comes up blank. Any ideas why?

    Thanks,
    Ashley

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    try it with this:

    <?php
    if(function_exists('register_sidebar')){
    register_sidebar(array('name' => 'Process Sidebar'));
    register_sidebar(array('name'=>'Contact Sidebar'));
    register_sidebar(array('name'=>'Services Sidebar'));
    }
    ?>

    Thank you! This worked perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Help with formatting functions.php for dynamic sidebar’ is closed to new replies.