• Well, this would be the first time I’ve attempted to use wordpress, nevermind the fact that I’m trying to build a theme from scratch, so bare with me.

    Basically, I built my HTML page and want to incorporate it into a WP theme. I won’t list ALL of my issues in one post, so here’s the first wall I’ve hit:

    I can’t figure out why the sidebar won’t sit to the right of my Main column – it just sits under it. All the content beneath the header/nav is in a “contentwrapper” div tag. Seems the problem is I have a “maincolumn” div tag (after the content wrapper and before the sidebar/footer) that wordpress just doesn’t see for some reason. It’s wrapping the main column and sidebar in one div tag, not allowing it to separate. I realize this could be any number of things, but thought I’d pick some brains before mine start oozing out of my ears.

    Thanks in advance for any help/suggestions!

Viewing 10 replies - 1 through 10 (of 10 total)
  • please post a link to your site and the relavant codes; for instance header.php, index.php, sidebar.php, footer.php …

    (use the pastebin for the template code – https://codex.www.ads-software.com/Forum_Welcome#Posting_Code )

    Thread Starter JMTripp

    (@jmtripp)

    Thanks alchymyth, here they are.

    index.php: https://pastebin.com/sJfkBDmU
    header.php: https://pastebin.com/HjFYydx7
    sidebar.php: https://pastebin.com/vd9aAxds
    footer.php: https://pastebin.com/q7XbH5BW
    style.css: https://pastebin.com/FJbVa8hP

    Let me know if there’s anything else.
    My apologies if this coding is confusing – I’m pretty new to all of this!

    index.php:
    there is a </div> missing within the loop, before the ‘endwhile’;

    line 19 and 20 each open a div, but only one of them is closed in line 37;

    while developing, make it a habit to add html comments to closing divs, as in Twenty Eleven.

    example:
    </div><!--/ .containerContent -->

    Thread Starter JMTripp

    (@jmtripp)

    Thanks for your feedback!
    My thinking was that the divs on lines 19 and 20 were closed on 35 and 37…am I wrong? I added an extra just in case, but nothing changed.

    my mistake, you are right;

    do you have a template sidebar-rightSidebar.php which you are calling in index.php:

    <?php get_sidebar('rightSidebar'); ?>

    https://codex.www.ads-software.com/Function_Reference/get_sidebar

    if not, WordPress will call the default sidebar file from /wp-includes/theme-compat/sidebar.php

    Thread Starter JMTripp

    (@jmtripp)

    Hrm. I was just working with the sidebar.php file. I changed it to sidebar-rightSidebar.php and it looks like it defaulted back. I’m able to edit the sidebar just fine. It’s right aligned, it just refuses to sit next to the content. I checked it in a browser and the “mainColumn”, “mainContainer” & “containerContent” divs are nowhere to be found. The mainColumn div is the one that determines the width, allowing room for the sidebar. when previewed, it’s all nested in the “contentWrapper” div.

    Any other thoughts? thanks so much for taking the time to help. Appreciate it.

    there are a few confusions between css id and css class;

    <div class="mainColumn"> – change to a css ID

    <div id="mainContainer"> – change to css class

    <div id="containerContent"> – change to css class

    you can then keep the styles as they are:

    #mainColumn { }

    .mainContainer { }

    .containerContent { }

    there might be more.

    Thread Starter JMTripp

    (@jmtripp)

    Sorry about those – that was me desperately grasping at straws trying to bring those divs to life. I changed them back but still no luck.

    The problem really seems to be with my mainColumn tag. I don’t know how to make sure it wraps around everything (starting w posts, ending after comments). From what I can tell it’s in the right place – starting after get_header and closing before the get_sidebar/get_footer in index.php. I tried closing it in comments.php but that just threw the footer and sidebar underneath the contentWrapper.

    Thanks again for your time and patience.

    Thread Starter JMTripp

    (@jmtripp)

    Here’s the updated index. The ‘contentWrapper’ div opens on the last line of the header.php file.

    https://pastebin.com/htDMPSwe

    can you post a live link to the problem?

    how does the site validate? https://validator.w3.org/

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Div tags in index go missing? (First time trying to build a theme)’ is closed to new replies.