WordPress.org

Ready to get started?Download WordPress

Forums

Div positioning - PHP (9 posts)

  1. Hookturn
    Member
    Posted 1 year ago #

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

    Site Link: http://www.hookturnmelbourne.com
    Index.php: http://pastebin.com/Uf81swj4
    Header.php: http://pastebin.com/YBnDx5tC
    Sidebar.php: http://pastebin.com/uZ7JJgS3
    Style.css: http://pastebin.com/4h4wSiLv

    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></div>
    <div id=sbar>
    <?php get_sidebar(); ?>
    </div>

    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

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    Make sure your web page has valid markup
    http://validator.w3.org/check?uri=http%3A%2F%2Fhookturnmelbourne.com%2F&charset=%28detect+automatically%29&doctype=Inline&group=0

    This should help resolve issues like yours.

  3. Hookturn
    Member
    Posted 1 year ago #

    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.

  4. alchymyth
    Forum Moderator
    Posted 1 year ago #

    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 http://www.css-discuss.org/

  5. Hookturn
    Member
    Posted 1 year ago #

    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:
    http://i49.tinypic.com/2lximv6.png

    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.

  6. alchymyth
    Forum Moderator
    Posted 1 year ago #

    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.

  7. Hookturn
    Member
    Posted 1 year ago #

    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.

  8. Andrew
    Forum Moderator
    Posted 1 year ago #

    For solely CSS issues, try CSS Creator forum.

  9. Hookturn
    Member
    Posted 1 year ago #

    Thanks Andrew :)

Topic Closed

This topic has been closed to new replies.

About this Topic