• I’m widgetizing my theme. I searched the threads and looked at the Automattic tutorial as well.
    Lets come to the point:
    Below is my sidebar.php code

    <div id="sidebar2">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('sidebar2') ) : ?>
      <div id="loerum" class="boxed">
        <h2 class="title"><?php _e('Categories');?></h2>
        <div class="content">
          <ul>
            <?php wp_list_cats('sort_column=name&optioncount=1&hierarchical=0');?>
          </ul>
        </div>
      </div>
    <?php endif; ?>
    </div>

    And this is my function.php

    if ( function_exists('register_sidebar') ) {
    	register_sidebar(array('name' => 'sidebar2'),
    		array('before_widget' => '<div id="%1$s" class="%2$s">',
    		'after_widget' => '</div>',
    		'before_title' => '<h2 class="title">',
    		'after_title' => '</h2>',
    	));
    }

    And this is the markup output:

    <div id="sidebar2">
    <li id="links" class="widget widget_links"><h2 class="widgettitle">Blogroll</h2>
    
    	<ul>
    <li><a href="http://www.alexking.org/">Alex</a></li>
    <li><a href="http://inphotos.org/">Donncha</a></li>
    <li><a href="http://dougal.gunters.org/">Dougal</a></li>
    <li><a href="http://photomatt.net/">Matt</a></li>
    <li><a href="http://zengun.org/weblog/">Michel</a></li>
    <li><a href="http://zed1.com/journalized/">Mike</a></li>
    
    <li><a href="http://boren.nu/">Ryan</a></li>
    
    	</ul>
    </li>
    </div>

    But this is not the markup output that I want to have.
    Below is the markup that I want to get generated.

    <div id="sidebar2">
    <div id="links" class="boxed">
    <h2 class="title">Blogroll</h2>
    <div class="content">
    <ul>
    <li><a href="http://www.alexking.org/">Alex</a></li>
    <li><a href="http://inphotos.org/">Donncha</a></li>
    <li><a href="http://dougal.gunters.org/">Dougal</a></li>
    </ul>
    </div>
    </div>

    Is there anything wrong in my functions.php or sidebar.php?
    Thanks.

  • The topic ‘sidebar widget unexpected markup generated’ is closed to new replies.