WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Help with formatting functions.php for dynamic sidebar (3 posts)

  1. ashleymurphy
    Member
    Posted 3 years ago #

    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

  2. keesiemeijer
    moderator
    Posted 3 years ago #

    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'));
    }
    ?>
  3. ashleymurphy
    Member
    Posted 3 years ago #

    Thank you! This worked perfectly.

Topic Closed

This topic has been closed to new replies.

About this Topic