So, i got this code to retrieve the images inserted in a gallery within a post:
<?php
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'post_status'=>'inherit',
'post_mime_type' => 'image',
'post_parent' => $post->ID,
'orderby' => 'menu_order',
'order' => 'ASC'
);
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
$image_attributes = wp_get_attachment_image_src( $attachment->ID, 'full' );
?><img title="<?php echo $attachment->post_title; ?>" src="<?php echo $image_attributes[0] ?>" /><?php
}
}
?>
and the output if fine, except that some pictures are duplicated and given a class="cloned"
attribute.
This code is running within a basic loop:
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
with no extra special things before and after. This is happening locally and online as i wanted to be sure about this weird thing; here’s the demo. If you inspect the code you’ll see this:
<img class="cloned" src="http://k-win.fr/wptest/wp-content/uploads/2011/06/03mopi.jpg" title="03mopi">
<img src="http://k-win.fr/wptest/wp-content/uploads/2011/06/01.jpg" title="01">
<img src="http://k-win.fr/wptest/wp-content/uploads/2011/06/02.jpg" title="02">
<img src="http://k-win.fr/wptest/wp-content/uploads/2011/06/03mopi.jpg" title="03mopi">
<img class="cloned" src="http://k-win.fr/wptest/wp-content/uploads/2011/06/01.jpg" title="01">
But if you check the source code you wont see the class="cloned"
i’m speaking of (devil inside!).
It’s driving me a bit crazy cos it’s messing up with the pictures order in some cases and this one has to be respected from the order decided in the gallery’s options.
I checked with Opera, Chrome and Firefox, and all show me the same thing. Any clue?
that’s your nivo-slider at work