WordPress.org

Ready to get started?Download WordPress

Forums

WordPress sidebar (5 posts)

  1. dalv8
    Member
    Posted 1 year ago #

    How could I add a sidebar to my theme ? What do I have to edit in CSS ?

  2. potentweb
    Member
    Posted 1 year ago #

    You don't just edit CSS for this. You have to edit your theme and add an area for a sidebar and style it.

  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    some part of the needed coding is described here:
    http://codex.wordpress.org/Widgetizing_Themes

    if you want to have a separate sidebar template, you'll also need: http://codex.wordpress.org/Function_Reference/get_sidebar

    the more complex part is to create the html structure and css to integrate the sidbar into your theme's structure (as already rightly mentioned by @potentweb)

    in general, review http://codex.wordpress.org/Theme_Development

  4. dalv8
    Member
    Posted 1 year ago #

    Yes. Ok. In mainindex.php I have

    <div id="sidebar-nou">
    <?php if ( ! dynamic_sidebar( 'sidebar-nou' ) ) : ?>
    <?php endif; ?>
    </div>

    In sidebar.php I have:

    <?php if ( ! dynamic_sidebar( 'sidebar-nou' ) ) : ?>
    
    <?php endif; ?>

    And in CSS:

    #sidebar-nou {float: left;
        margin-left: 7.6%;
        margin-right: 0;
        margin-top: 20px;
        width: 22.8%; /* increased sidebar width 4% from 18.8% to 22.8% */
    }

    But, it is shown in footer, and I don't know why. The site: http://www.androidmaniac.net

  5. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    the location is caused by where you added the sidebar - within the #content div just like the other divs (#reclama and #androboxline);
    you possibly need to move the #sidedar-nou div to before or after the #content div; add 'float:left;' to the style of #content, restrict the width of the #content etc...
    maybe try and make a pure html/css mockup of your site's structure to figure out the formatting and positioning.

    unfortunately, this WordPress forum is not the place to explain and teach those fundamental formatting issues; try to improve your html/css knowledge by working with tutorials such as http://www.w3schools.com/, or possibly ask for support at a different forum such as http://www.css-discuss.org/

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.