• Hello

    I found this code on the forum and it worked perfectly with me

    <?php
    
    $args = array(
    	'post_type' => 'attachment',
    	'numberposts' => null,
    	'post_status' => null,
    	'post_parent' => $post->ID
    );
    $attachments = get_posts($args);
    if ($attachments) {
    	foreach ($attachments as $attachment) {
    
    		the_attachment_link($attachment->ID, false);
    	}
    }
    
    ?>

    I understand it create an array to list all the attachments in the post , but how can i skip the first one..

    The thing is im trying to create a gallery of images beneath the post content, but i want to show the first one (in order) inside the content and list the rest under it

    Regards

Viewing 1 replies (of 1 total)
  • Try using:

    $args = array(
        'post_type' => 'attachment',
        'numberposts' => null,
        'post_status' => null,
        'post_parent' => $post->ID'
        'offset' => 1
    );
Viewing 1 replies (of 1 total)
  • The topic ‘How to show post attachments (skipping the first one!!)’ is closed to new replies.