Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 1 down vote accepted

that's your nivo-slider at work

share|improve this answer
    
True, it wasn't wordpress but the slider, which was not nivo but another one. I changed it and got it all working fine at last. Thanks a lot Piet. –  kevin Jun 15 '11 at 15:40
    
glad you got it working @kevin –  Piet Jun 16 '11 at 0:48
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.