Grow your CSS skills. Land your dream job.

[WordPress] Multiple images through Custom Fields

  • # June 24, 2013 at 7:42 am

    Hello, I want to attach few images through custom fields.
    I read this article (http://css-tricks.com/forums/discussion/1206/wordpress-posts-image/p1 “”) and I was able to show images, but I want to show them without adding the source in my code for each image. Please, is there a way to accomplish this? Thank you very much!
    My actual code is this:

    < ?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    “>< ?php the_title(); ?>

    < ?php the_category('title_li=' ) ?>

    < ?php the_content(); ?>

    “>

    < ?php endwhile;?>
    < ?php endif;?>

    # June 24, 2013 at 8:39 am

    Sometimes just writing helps to figure out :) So, I added this code, and it works now.

    # June 24, 2013 at 8:40 am
    < ?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    “>< ?php the_title(); ?>

    < ?php the_category('title_li=' ) ?>

    < ?php the_content(); ?>

    < ?php
    $thumbnails = get_post_meta($post->ID, “thumb”, false);
    if ($thumbnails[0] != ”) :?>

    < ?php foreach($thumbnails as $thumb) {
    echo ‘‘;
    } ?>

    < ?php endif; ?>

    < ?php endwhile;?>
    < ?php endif;?>

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".