• Resolved webtycoon47

    (@webtycoon47)


    I added a second sidebar (fully widgetized) for the left part of my blog, the first being on the right. I have the second sidebar called before the content in index.php, page.php and single.php, and both are floated left. When I add a widget to this sidebar, it appears above the content pushing it down. The first sidebar is straight across from this one, where it should be. What could be the problem? I have limited knowledge of php, I basically learn as I go. I’d really appreciate help from someone whos better at it.

Viewing 15 replies - 1 through 15 (of 22 total)
  • Post some of your CSS for the sidebar. I will look at it.

    Thread Starter webtycoon47

    (@webtycoon47)

    Thanks for the reply!

    #sidebar2.php {
    float: left;
    width: 280px;
    display: inline;
    margin-top: 0px;
    margin-right: 125px;
    padding-right: 20px;
    padding-bottom: 40px;
    }

    sidebar2.php is the new file I created for the second sidebar. Its the same css as the other except it floats left instead of right.

    A padding or margin problem? perhaps your (wrap?) is not wide enough to have a second sidebar

    Can you post the URL of your site?

    Thread Starter webtycoon47

    (@webtycoon47)

    https://www.rawhealthweb.com/ I don’t have anything in the second sidebar right now. When I do it appears in the top left corner of the gay area of blog, pushing the content down.

    Heres some more of my stylesheet:

    [css code moderated - a link to your site is sufficient]

    Okay so i figured out that my wrap isn’t wide enough to accommodate both sidebars. When I made it larger my site got all messed up and the left sidebar widgets still displayed above the content. The #sidebar is called before #central in the css. Do you see that space around my blog? I want a vertical ad in the left, outside the blog’s body just like my banner ad is in the space above. Is there another way of doing this besides adding a widgetized sidebar? I need this left space to be transparent like it is now, only widgets will display in it.

    A few points

    The order that elements appear in the css does not influence the order they appear on screen.

    Your second sidebar cannot have an id of sidebar2.php just give it an id of sidebar2 and style it in the css as #sidebar2 not #sidebar2.php.
    It is not being styled at all at the moment because the css is referring to a CLASS of php within an ID of sidebar2.

    What is the purpose of the sidebar2 div? At the moment it appears inside the central div.

    I’ve just re read your earlier post and realised that sidebar2.php is the name of a file that you have created. You can’t include a file in the html like that.

    Thread Starter webtycoon47

    (@webtycoon47)

    lockettpots, I can’t thank you enough! That fixed it, my ad is now on the left where its easier to see. Thanks to everyone else who replied as well.

    One more question if I may. I added a new widget area in the page.php of my blog called body. I added this <div class=”footer-widget”><?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(“Body”) ) : ?> to the page.index and also registered it in functions.php. Everthing works great except that widgets placed in this area appear above my sidebar on the right instead of right below the header title for the page content in between the two sidebars. What css changes will fix this?

    Rename the div class to something like class=”body-widget” so that you can apply styling separately to this div.

    In your page.php try moving the

    <div class="body-widget"><?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Body") ) : ?>

    to just above where you are calling the_content()

    In your style.css make a new rule

    .body-widget{
    
    }

    and put any styling you want to apply in between the brackets.
    As I am working somewhat ‘blind’ this may not be exactly what you want but hopefully it will point you in the right direction.

    Sorry amend the earlier post to read

    In your page.php try moving the code (<div class=”body-widget” …</div>)
    to just above where you are calling the_content and surround this with ?> <?php

    You need these to separate the php code from the html code.

    If this doesn’t make sense to you just ask

    Thread Starter webtycoon47

    (@webtycoon47)

    Thanks again friend! Simply moving the div class above where I call the content fixed it, I don’t know why I didn’t think of that myself. Appreciate the help.

    Im having a similar problem as well, i just tried to install a new sidebar to the left of my blog for ads now my whole blog has gone crazy the body is being entered down by the sidebar2 i have and now my widgets are not showing in my sidebar 1. please help here are a few of my codes!

    Functions.php

    [code moderated - please use the pastebin]

    and i was told to create a sidebar2.php which is:

    [please mark the code using the 'code' button]

    <div>
    
    <ul>
    <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) : else : ?>
    <?php endif; ?>
    </ul>
    </div>

    I have nooo idea what to do nextt! at all please your help would be soo greatly apprciated!

    @celebshoe

    as you may have seen from the earlier replies in this topic, it is important that you post a link to your site – otherwise it is quite impossible to help you with your problem.

    sorry celebrityshoestatus.com

    your sidebar does not seem to be generated – i only see a ‘hide widgets’ link on the right.
    there is no typical sidebar html output in your page, when checked in the browser.

    check your index.php (?) if it contains the ‘get_sidebar()’ code.

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Sidebar is above content’ is closed to new replies.