Odd Sidebar Question (2 posts)

  1. hardy24
    Posted 9 years ago #

    Hi, odd question.

    I need to put something, some content into the top of my sidebar, but it's significantly wider than everything else in my sidebar, so I don't want to simply increase the width of the sidebar to accomodate it.

    So what I want to do is to place it before the sidebar, at the top. Which i'm pretty sure I can do. My question comes when I get to thinking about the main content to the left of the sidebar. The posts beside the wider content need to have a smaller width to make room for it, but then posts below it should just be regular width.

    As far as i'm aware there is no way to differ the width of the posts because it's just one command which gets and places the posts. No way to say get posts 1 & 2 with this width, then posts 3 onwards with this width.

    Anyone - any ideas are greatfully received

  2. WedgeMcCloud
    Posted 9 years ago #

    I can only speak figuratively as I know very little PHP, but you would probably use variables.

    In your loop, you would increase a variable for your width by one for each post. Then, with each post, check that variable and if it's less than three (posts 1 and 2) they would use one loop coding, otherwise (the 'else' case) they would use a second code (for the third post and onward).

    The implementation is similar to alternating colors for comments, I think. It seems easy if you know how to code PHP, but I know little of variables so I can't give you code right away. I would if I could, though.

Topic Closed

This topic has been closed to new replies.

About this Topic