WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Get The Image] Pull 8 Random Images From Custom Field On Post (1 post)

  1. imaginethepoet
    Member
    Posted 5 years ago #

    This is a great plugin and I use it for 2 things. Currently to pull an image into the excerpt of each post on the front page.

    I'm working on a new theme and want to pull the 7 random images from my posts to display (custom field for this in my posts is thumb_gallery.) The following query works fine but pulls only those images returned in the have_posts()function.

    I'm thinking in order to pull the posts randomly I need to write a new query and a new function to grab a random post, custom field, and required other fields.

    Anyone expereinced with this plugin attempt to pull random custom fields.

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
    <?php get_the_image( array( 'custom_key' => array( 'thumb_gallery' ), 'default_size' => 'medium', 'width' => '100', 'height' => '100', 'image_class' => 'tm_image' ) ); ?>
    <?php endwhile; endif; ?>
    </div>

    thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 5 years ago by imaginethepoet
  • This topic is not resolved
  • WordPress version: 2.7.1