Forums

Every Other Post A Different Photo (Odd / Even) (3 posts)

  1. UncleBrian
    Member
    Posted 5 years ago #

    I'm stumped. I hope you can help.

    I think I need an if/else inside an if/else. I am running a modified Hemingway theme. Basically, I force it to load just two posts on the main page. The first post (defined "story first") goes on the left side of a split column and the second ("story") goes to the right. That is defined in an if/else.

    I really wanted to put 4 or 6 posts on the front page but I couldn't figure out how to make an odd/even if/else (where odd equals "story first" and even would equal "story").

    Anyway, I am stuck with two posts right now.

    Here's the thing, I want a static image for one post (the excerpt) and a different static image for the second post.

    With me so far?

    Here is the code. Imagine a different image being inserted where it says "IMAGE#1" or "IMAGE#2...

    <div id="primary" class="twocol-stories">
    <div class="inside">
    <?php query_posts('showposts=2'); ?>
    <?php if (have_posts()) : ?>
    <?php $first = true; ?>
    <?php while (have_posts()) : the_post(); ?>
    <div class="story<?php if($first == true) echo " first" ?>">
    <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <img align="left" src="IMAGE#1 or IMAGE#2" alt="News" title="News" /><?php the_excerpt() ?>
    <div class="details">
    Filed Under: <?php the_category(', ') ?> | <span class="read-on"><a href="<?php the_permalink() ?>">read on</a></span>
    </div>
    </div>
    <?php $first = false; ?>
    <?php endwhile; ?>
    <?php else : ?>
    <?php endif; ?>

    Does that make sense to you?

    THANK YOU!!!

  2. mrbeerbelly
    Member
    Posted 5 years ago #

    Post this on eLance. You will never get support here.

  3. UncleBrian
    Member
    Posted 5 years ago #

    Okay! I'll check out elance!

Topic Closed

This topic has been closed to new replies.

About this Topic