Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sribharath

    (@sribharath)

    any one?

    How to get the first image attached the post:

    $images = get_children(array(
        'post_parent' => $post->ID,
        'post_type' => 'attachment',
        'post_mime_type' => 'image',
        'orderby' => 'ID',
        'order' => 'ASC'
      ));
      if($images){
        $ids = array_keys($images);
        $id = $ids[0];
        $url = wp_get_attachment_image_src($id);
      }else{
        /* no image */
      }

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to call image’ is closed to new replies.