Title: Div positioning &#8211; PHP
Last modified: August 20, 2016

---

# Div positioning – PHP

 *  [Hookturn](https://wordpress.org/support/users/hookturn/)
 * (@hookturn)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/)
 * 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](http://www.hookturnmelbourne.com)
   
   Index.php: [http://pastebin.com/Uf81swj4](http://pastebin.com/Uf81swj4) Header.
   php: [http://pastebin.com/YBnDx5tC](http://pastebin.com/YBnDx5tC) Sidebar.php:
   [http://pastebin.com/uZ7JJgS3](http://pastebin.com/uZ7JJgS3) Style.css: [http://pastebin.com/4h4wSiLv](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

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066754)
 * 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](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.
 *  Thread Starter [Hookturn](https://wordpress.org/support/users/hookturn/)
 * (@hookturn)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066758)
 * 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.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066763)
 * 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/](http://www.css-discuss.org/)
 *  Thread Starter [Hookturn](https://wordpress.org/support/users/hookturn/)
 * (@hookturn)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066765)
 * 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](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.
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066779)
 * 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.
 *  Thread Starter [Hookturn](https://wordpress.org/support/users/hookturn/)
 * (@hookturn)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066823)
 * 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.
 *  [Andrew Nevins](https://wordpress.org/support/users/anevins/)
 * (@anevins)
 * WCLDN 2018 Contributor | Volunteer support
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066824)
 * For solely CSS issues, try [CSS Creator](http://csscreator.com/forum) forum.
 *  Thread Starter [Hookturn](https://wordpress.org/support/users/hookturn/)
 * (@hookturn)
 * [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066836)
 * Thanks Andrew 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Div positioning – PHP’ is closed to new replies.

## Tags

 * [divs](https://wordpress.org/support/topic-tag/divs/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [positioning](https://wordpress.org/support/topic-tag/positioning/)

 * 8 replies
 * 3 participants
 * Last reply from: [Hookturn](https://wordpress.org/support/users/hookturn/)
 * Last activity: [13 years, 8 months ago](https://wordpress.org/support/topic/div-positioning-php/#post-3066836)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
