Support » Themes and Templates » Unable to widgetize theme

  • Hey everyone,

    I’ve been trying and working my ass off to widgetize my theme. Got this Deichnetz Theme, running WP 2.0.

    This theme hasn’t got a functions.php, so created one with the obligatory php-code. Than I added the code in the sidebar.php to make the thing dynamic (activating plugin course) and than my sidebar disappears and I get this error about the last line of my sidebar.php (which is a /div tag>.

    Can anyone help me to Widgetize my theme? My sidebarcode is:
    <!-- begin sidebar -->
    <div id="sidebar">
    <h4>&nbsp;</h4>
    <div id="sidemenu">
    <ul> || PUTTING THE DYNAMIC PHPCODE HERE
    <li id="categories"><h2><?php _e('Categories:'); ?></h2>
    <ul>
    <?php wp_list_cats(); ?>
    </ul>
    </li>
    <?php get_links_list(); ?>
    <li id="archives"><h2><?php _e('Archives:'); ?></h2>
    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>
    </li>
    <?php if (function_exists('wp_theme_switcher')) { ?>
    <li><h2><?php _e('Themes'); ?></h2>
    <?php wp_theme_switcher('dropdown'); ?>
    </li>
    <?php } ?>
    </ul>
    </div>
    <h5>&nbsp;</h5>

    <div class="feeds"><a href="<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS°'); ?>">rss</a></div><!-- feeds -->
    <div class="feeds"><a href="<?php bloginfo('atom_url'); ?>" title="atom feed°">xml</a></div>

    </div>

    Any ideas what to do? Btw, should I CHMOD any Widget folders too (to make sure)? Hope someone can HELP me! 😀

Viewing 5 replies - 1 through 5 (of 5 total)
  • What’s the error? Do you have a link?

    Thread Starter kekness

    (@kekness)

    I used to get this Parse Error on the place where my sidebar should start … so I got in and extra
    ‘<?php endif; ?>’ before the last UL tag.

    Now I’ve tried it all over again and the now nothing happens … no errors, but still the same sidebar, no Widget panel in my backoffice … :s

    I suspect the problem is here:
    <ul> || PUTTING THE DYNAMIC PHPCODE HERE

    Also, 1 ‘endif’ for each ‘if’…

    Thread Starter kekness

    (@kekness)

    Hmz what do you mean? This is the code right now:

    ‘<!– begin sidebar –>
    <div id=”sidebar”>
    <h4> </h4>
    <div id=”sidemenu”>

      <?php if ( !function_exists(‘dynamic_sidebar’)
      || !dynamic_sidebar() ) : ?>
      <li id=”categories”><h2><?php _e(‘Categories:’); ?></h2>
      <?php wp_list_cats(); ?>

    <?php get_links_list(); ?>
    <li id=”archives”><h2><?php _e(‘Archives:’); ?></h2>

      <?php wp_get_archives(‘type=monthly’); ?>

    <?php if (function_exists(‘wp_theme_switcher’)) { ?>

    You’re missing an “else”.

    When you have an “if”, you need to have an “else” if something is an alternate.

    What your code says is “If you have a dynamic sidebar, display it *and* the regular sidebar”.

    Your code should look more like this:

    <!-- This is where you edit your sidebar. You can easily "widgetize" your sidebar, but if you choose not to use widgets, there are options here to still have the same type of sidebar. -->

    <div id="sidebar">

    <!-- This next line basically says "If you have Widgets activated, use them...or else... -->

    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : else : ?>

    <!-- ...here is what will show if Widgets are not enabled. -->

    <h4> </h4>
    <li id="categories"><h2><?php _e('Categories:'); ?></h2>

    <?php wp_list_cats(); ?>
    <?php get_links_list(); ?>

    <li id="archives"><h2><?php _e('Archives:'); ?></h2>

    <?php wp_get_archives('type=monthly'); ?>
    <?php if (function_exists('wp_theme_switcher')) { ?>

    # <h2><?php _e('Themes'); ?></h2>
    <?php wp_theme_switcher('dropdown'); ?>

    <h5> </h5>

    <div class="feeds">" title="<?php _e('Syndicate this site using RSS°'); ?>">rss</div><!-- feeds -->
    <div class="feeds">" title="atom feed°">xml</div>

    <?php } ?>
    <?php endif; ?>
    </div> <!--closing #sidebar -->

    See the differences? You may have to mess with the div codes (for positioning and stuff), and make some other adjustments, but you’ve got everything in the wrong place as it is now.

    Hope that helps 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Unable to widgetize theme’ is closed to new replies.