• I’m trying to register a sidebar for my Footer and I’m looking to get a custom widget that I’ve made working. It was working before, quite nicely too.

    However, when I went to log back into the WordPress, I got an error and couldn’t do so. I’ve tried using the codex to register my sidebar, and for whatever reason that doesn’t work.

    I’m using a child theme of 2010 with my own functions.php

    [Code moderated as per the Forum Rules. Please use the pastebin]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter yetimade2

    (@yetimade2)

    I should mention that WordPress absolutely hates any code I add to this functions document. It has a complete,total, and utter conniption fit and breaks.

    First, you’re naming two different sidebars “footer”.

    Second, you have some calls to register_sidebar inside a function_exists() conditional, with one outside of the conditional. (You can safely remove the conditional, but in any case, be consistent.)

    Third, you have one sidebar to which you fail to assign a name (I assume this one to be your actual “sidebar” Widgetized sidebar?)

    Fourth, you have this code commented in HTML comment tags; why? This code should be in your functions.php file, and commented using PHP comment tags.

    Assuming you only want one footer sidebar (and one “sidebar” sidebar), try refactoring the above code as follows:

    <!-- Start Register Widgetized Sidebars -->
    <?php
    register_sidebar(array(
    'name' => 'footer',
    'before_widget' => '<div id="%1$s" class="widget %2$s">',
    'after_widget' => '</div>',
    'before_title' => '<h2>',
    'after_title' => '</h2>',
    ));
    register_sidebar(array(
    'name' => 'right-column',
    'before_widget' => '<li id="%1$s" class="widget %2$s">',
    'after_widget' => '',
    'before_title' => '<h2 class="widgettitle">',
    'after_title' => '</h2>',
    ));
    ?>
    <!-- End Register Widgetized Sidebars -->

    Then, make sure each of your calls to dynamic_sidebar() (e.g. in “sidebar.php” and “footer.php” reference the appropriate sidebar, as defined above.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Register Sidebar for Footer’ is closed to new replies.