• After just figuring how to style posts from a specific category using post_class I inserted the following code into my single.php file
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    I then added .category-blog to my CSS which allowed me to independently style all posts with the category “blog”.

    However wherever I seem to insert
    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    into single.php, the sidebar of the site gets shifted to the bottom of the page when looking any single post. Does anyone have any ideas?

    Here is the link to the code for single.php currently

    SINGLE.PHP

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • Is there a URL where we can see this?

    Thread Starter ilew

    (@ilew)

    Yea here is a link to a post LINK

    ok, it looks like there are a couple of things going here. I think you have your sidebar div inside your main-container div. I don’t know if that was intentional or not. I would guess no because your width is set to 540 on the main-container, so it’d be my guess that it needs to go outside.

    (I played with the layout a little in firebug and I suspect that’s the reason for the error)

    when you insert this:

    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

    you are effectively opening a new div – which you need to close as well –
    add:
    </div>
    before this line:
    </div><!--post-content-->

    Thread Starter ilew

    (@ilew)

    You guys are truly amazing. It’s all fixed. Thanks so much for the help 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘When inserting post_class into single.php, sidebar gets shifted’ is closed to new replies.