WordPress.org

Support

Support » Themes and Templates » one post one way second post another way

one post one way second post another way

  • 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?

Viewing 5 replies - 1 through 5 (of 5 total)
  • 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>

    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/

    correct :>

    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).

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘one post one way second post another way’ is closed to new replies.
Skip to toolbar