WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Customize output of sidebar widgets (3 posts)

  1. artcoder
    Member
    Posted 5 years ago #

    The dynamic sidebar widget of the default theme is generating ...

    <ul>
    <li class="widget"></li>
    <li class="widget"></li>
    </ul>

    I need to change it to be ...

    <ul>
    <li class="widget">
    <div class="widgettop"></div>
    <div class="widgetbody"></div>
    </li>
    <li class="widget">
    <div class="widgettop"></div>
    <div class="widgetbody"></div>
    </li>
    </ul>

    Where to alter the PHP code? I can not find in sidebar.php nor in the wp-include/widget.php.

    Is there way to overwrite wp-include/widget.php by putting a file in the custom theme directory?

  2. Doodlebee
    Member
    Posted 5 years ago #

    Yes, in your functions.php file. Here's two places to read up on it, and a sample bit of code:

    if (function_exists('register_sidebar'))
    {
        register_sidebar(array(
                  'before_widget' => '',
                  'after_widget' => '</div>',
                  'before_title' => '<h2>',
                  'after_title' => '</h2>'
         ));
    }
  3. wza
    Member
    Posted 4 years ago #

    what if you want to do this for just one widget within the dynamic sidebar, and not all? (f.e. tagcloud)

Topic Closed

This topic has been closed to new replies.

About this Topic