WordPress.org

Support

Support » How-To and Troubleshooting » Last attachment post duplicating

Last attachment post duplicating

  • Trying to trouble shoot why the last attachment in our post is duplicating. Example post:
    http://www.ourgoodfight.com/?p=6165

    Here is the code that is generating the attachments

    <?php
    $args = array(
    	'post_type' => 'attachment',
    	'post_mime_type' => 'audio/mpeg',
    	'numberposts' => -1,
    	'orderby' => 'menu_order',
    	'order'  => 'ASC',
    	'post_status' => null,
    	'post_parent' => $post->ID, // this post
    	);
    ?>
    
    <!--This is where the audio attachments will go -->
    
    <?php $posts = get_posts($args);
    foreach ($posts as $post) : start_wp(); ?>
    <p>
    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
    </p>
    <?php endforeach; ?>
                                <!--This is the end of the audio attachments -->

    Thanks.

  • The topic ‘Last attachment post duplicating’ is closed to new replies.
Skip to toolbar