Forums

[resolved] Pull 3 posts from specific category with thumbnail from custom field (3 posts)

  1. dreamslikefire
    Member
    Posted 2 years ago #

    I am trying to pull 3 posts from specific category (7) with thumbnail from custom value (Custom field is "Featured Thumbnail" and value is image path) and also have a "Read More" button for each. Can anyone help me out? I would think this would be some pretty quick and easy code.

  2. kz
    Member
    Posted 2 years ago #

    <?php
    query_posts('cat=7&posts_per_page=3');
    if(have_posts()) :
      while(have_posts()) :
        the_post();
        ?>
        <div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
          <h2><?php permalink(); ?></h2>
          <div class="entry">
          <?php
          $img = get_post_meta($post->ID, 'Featured Thumbnail', true);
          ?><img src="<?php echo $img; ?>"/><?php
          the_content('Read More');
          ?>
          </div>
        </div>
        <?php
      endwhile;
    endif;
    wp_reset_query();
    ?>
  3. dreamslikefire
    Member
    Posted 2 years ago #

    Thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Topic