Viewing 1 replies (of 1 total)
  • Hi,

    I also needed, I searching on web about it and not found anything, so I’ve read the Simple Gallery code for understand how I can this, and below the instructions:

    To get the images id use
    <?php $ids = get_meta_post ( $post->ID, 'wpsimplegallery_gallery'); ?>

    With the ids, you can get what you want, examples:

    To get the url (on media) of the first image
    <?php $url = wp_get_attachment_url ( $ids[0] ); ?>

    To get the generic thumb
    <?php the_attachment_link ( $ids[0] ); ?>

    To get the first 4 images

    <?php
    $images = array();
    for($i = 0; $i < 4; $i++) {
      $images[$i] = wp_get_attachment_image_src ( $ids[$i], array(320,160) );
      // 320, 160 = width, height or name of your thumb
    }
    ?>

    Hope this helps, I you need I am available.

Viewing 1 replies (of 1 total)
  • The topic ‘Get First Image Of the Gallery’ is closed to new replies.