• Hi Team,

    i am using below code for generate images in feed,

    function show_image_feed($content) {
    
    global $post;
    $args = array(
    'post_type' => 'attachment',
    'numberposts' => 1,
    'post_status' => null,
    'post_parent' => $post->ID
    );
    
    $attachment = get_posts($args);
    
    if ($attachment) {
    
     $content =  wp_get_attachment_image($attachment[0]->ID, 'medium') .'<p>'. $content . '</p>' . '<br />';
    }
    
    return $content;
    
    }
    
    add_filter('the_excerpt_rss', 'show_image_feed'); // for feed excerpts
    add_filter('the_content_feed', 'show_image_feed'); // for full feeds

    I included two images into the post one at the top and another one in bottom. but in the feed the bottom images is displayed first in the content part, i need first (top) image of the post.

    What i need to do?

  • The topic ‘wp_get_attachment_image – Last image returned from post’ is closed to new replies.