WordPress.org

Ready to get started?Download WordPress

Forums

How To Setup Multiple Post Images and Post Order (4 posts)

  1. kraftomatic
    Member
    Posted 5 years ago #

    Hey Guys,

    I'm trying to setup my core blog page like this. The latest two posts will show the full content along with a full-size image.

    I'd like to have the 3rd, 4th and 5th oldest posts show on a different section of the page, and just display an excerpt of the post, with a smaller/secondary type image. I'm not sure what the best way would be to go about doing this.

    Any suggestions would be appreciated.

    Thanks.

  2. renato_s
    Member
    Posted 5 years ago #

    You have to create 2 Loops. Search the Codex for "The Loop".

    Then, you have to call from inside the loops for two different custom fields, each linking to a different image (full size, thumbnail).

    You can use something like this:
    For the first (full size image):
    <a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php echo get_post_meta($post->ID, "image", true); ?>" alt="<?php the_title(); ?>" /></a>

    For the second one:
    <a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php echo get_post_meta($post->ID, "thumbnail", true); ?>" alt="<?php the_title(); ?>" /></a>

    Obviously, you have to define the custom fields in the Write Post panel, using the keys "image" and "thumbnail".

    Hope this helps!

  3. kraftomatic
    Member
    Posted 5 years ago #

    That does .. so I just need to add the code which checks for which post count it is (most recent, 2nd most recent, etc. etc.) it appears ..

  4. Tom Lany
    Member
    Posted 5 years ago #

    Thanks! This helped me a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.