WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] how to de-widgetize the sidebar? (3 posts)

  1. Cathy Tibbles
    Member
    Posted 6 years ago #

    How do I de-widgetize the sidebar? I'd prefer to write my own sidebar in the template file.

    Thanks

  2. Adam Brown
    Member
    Posted 6 years ago #

    In your WP admin, remove all widgets from the sidebar. Done. Now it will revert to whatever is in the sidebar.php file.

    In sidebar.php, you'll see something like this:

    <ul id="sidebar">
    <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
     <li id="about">
      <h2>About</h2>
      <p>This is my blog.</p>
     </li>
     <li id="links">
      <h2>Links</h2>
      <ul>
       <li><a href="http://example.com">Example</a></li>
      </ul>
     </li>
    <?php endif; ?>
    </ul>

    Everything between the if and the endif is what displays when you remove all widgets (using the admin menu). Put whatever you want between the if and endif and it will display when there aren't widgets.

  3. Cathy Tibbles
    Member
    Posted 6 years ago #

    perfect! thank you.

Topic Closed

This topic has been closed to new replies.

About this Topic