WordPress.org

Ready to get started?Download WordPress

Forums

one post one way second post another way (6 posts)

  1. mrlarter
    Member
    Posted 9 years ago #

    I was wondering if this was possible from anyones point of view.
    I want it so that the first post in the journal is on the left side and the second post is on the first,. the third post is on the left and the fourth is on the right and so on.
    basically the only real change will be an image on the right or the left depending on the post number. any ideas if this would work or not?

  2. Ozh
    Member
    Posted 9 years ago #

    The integer of the post_ID divided by 2 will give either 0 or 1. You could create classes like :
    .1 {float: left;}
    .0 {float: right;}
    Then a solution would be to add into your my-hacks.php a slightly modified version of the_ID() using the operator "% 2", and then use:
    <div class="post <?php my_the_ID() ?>">
    Without even modifying the php script and using instead a little (ugly) javascript, something like would either write "0" or "1" :
    <script>
    var postid = <?php the_ID() ?>;
    var postclass = postid % 2;
    document.write(postclass);
    </script>

  3. rayne
    Member
    Posted 9 years ago #

    This will work as long as you don't delete a post. If you delete the post, you may have a whole, where a post floated right, but there wasn't one to float left beside it. You could make every post float left within the container div. Then when it gets to the end, it will wrap. I know there have been some articles explaining how to do this. Here's one that might help: http://www.alistapart.com/articles/practicalcss/

  4. Ozh
    Member
    Posted 9 years ago #

    correct :>

  5. Anonymous
    Unregistered
    Posted 9 years ago #

    Theoretically, this could be accomplished quite easily with the CSS3 ::nth_child() selector.
    However, the only browser which actually supports this is MSN/Mac (even MSN/Win doesn't do it).

  6. mrlarter
    Member
    Posted 9 years ago #

    thanks will try this tonight
    the site its for is http://www.memenetphoto.com and its for the bottom area there.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.