Forums

[resolved] register_sidebar and dynamic_sidebar not working like I thought it should? (2 posts)

  1. mwaterous
    Member
    Posted 2 years ago #

    This topic seems to come up a bit, but I couldn't to find an answer in the posts I searched. I'm sure this will be a simple one, so I apologize in advance for taking your time, but I'm hella green with wordpress themes and I'm starting small on my wife's self hosted blog.

    I have a theme that for some reason decided to hardcode the sidebar (LenoMag) instead of allowing for dynamic sidebars, so I'm trying to change that as there's a few widgets my wife doesn't want! I added the following to functions.php (over simplified for now until it actually works!):

    if (function_exists('register_sidebar'))
    {
        register_sidebar(array('before_widget' => '',
                  'after_widget' => '</div>',
                  'before_title' => '<h2>',
                  'after_title' => '</h2>'));
    }

    ...and the following to sidebar.php:

    <?php	if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>
    Try tryyyy again...
    <?php endif; ?>

    It displays the sidebar, but it doesn't format it like I ask it to. The formatting it does do around the title is as follows, which I assume is the default:

    <h4 class="widget-title">...</h4>

    not my H2's.

    Is there a typo I'm missing? Argh!!

  2. mwaterous
    Member
    Posted 2 years ago #

    ahhh sorry I was trying to figure out why when I registered multiple sidebars none of them showed up in the admin panel, and I discovered the error of my ways. I try to learn by dissecting other peoples work in addition to what I read, and I was editing the functions.php of another theme while editing the proper sidebar.php file....

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.