Support » Themes and Templates » Div positioning – PHP

  • I’ve been making a child theme of Sight and been trying to position my divs with little success.

    Site Link:

    If you visit the link and view the php files above, you can see that the header, slider, and latest post are all enclosed in a div called wrapper, but my sidebar, which I have put in a div named #sbar is not. This is currently due to this code in index.php:

    <div id=sbar>
    <?php get_sidebar(); ?>

    However if one of the </div> tags is removed, then #sbar is enclosed not only in wrapper but also in div#container.clear and after over 5 hours I still cannot figure out why!

    What I want to have displayed is: Under div.nav to have three main divs: div.slideshow, directly under this div#container.clear, and alongside the two div#bar.

    I really hope someone can help me as I am really lost on what to do. If anyone needs any additional information, please let me know.

    Thank you in advance

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Andrew Nevins


    Make sure your web page has valid markup

    This should help resolve issues like yours.

    Hi Andrew,

    Thank you for your response. I ran the markup validator link and found that most of the errors were my attempts to make the new div for the sidebar, I got rid of them, but still have no clue what I should do to position the sidebar where I need it. Any suggestions?

    Also one of the issues seems to be that the searchbar is being used twice. That’s another problem I’ve been having. When I was editing Sight directly I was able to specify through theme menu options that I wanted the search bar in the sidebar and not the header. I did this in the child theme, but I think the parent theme is still giving the command for the search bar to appear in the header (as is the default) and I’m not sure how to turn it off.



    Forum Moderator

    where do you want to locate the div #sbar ?

    (which right now does not seem to be within the code of your linked site)

    you seem to have narrowed the .slideahow and #container div – why?

    can you provide a drawing of your layout idea?

    in the sight demo, the div .sidebar is within the div #container.clear – why do you need that different?

    btw: the whole problem has nothing to do with PHP – this is a fundamental html/css formatting issue for which this WordPress forum might not be the best place to get solutions – possibly try to ask at

    I deleted the div #sbar because the validator found that the code I’d used for it was invalid. I narrowed .slideshow and #container because I want the side bar to be next to them, but within wrapper so they need to be thinner to make room. Right now it seems that if .sidebar is inside #container.clear it cannot be next to the slideshow.

    I want it to display like this:

    I can use css to move the sidebar, but when I use position: absolute tags, it doesn’t display consistently in the index and post pages.



    Forum Moderator

    you possibly could wrap .slideshow and #container into an new div, and float that left; add ‘clear:both;’ to the style of .footer; and move the sidebar to after the end of #container.

    I stop here, because, imho, detailed solutions to what is more or less a pure html/css problem, are beyond the scope of this WordPress forum.

    Thank you, I know it’s mainly a CSS issue, but it seems that I’d have to create the new div to wrap .slideshow and #container in the php somewhere and that is what I don’t know what to do. Are you able to shed any light on that for me or tell me where it is I should go for help with that?

    The way the css stylesheet is written I don’t think I can do anything beyond formatting elements already defined defined in the php. Or am I able to create a new div in the stylesheet? If you look at style.css above you’ll see that it’s pure css, no <div></div> tags at all.

    Moderator Andrew Nevins


    For solely CSS issues, try CSS Creator forum.

    Thanks Andrew 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Div positioning – PHP’ is closed to new replies.