• Resolved vanzvik

    (@vanzvik)


    Hello there ??

    I am using WordPress as a CMS controlled portfolio.

    After i upload all images to a page i see them in reversed order…

    this is the code i am using (on the template) to show them:

    $attachments = get_children( array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' =>'image', 'orderby' => 'ASC') );
    $nbImg = count($attachments);
    require('/wp-content/themes/ellasverdlov/headerp.php'); ?>
    			<div id="slider" style="width:<?php echo $nbImg*618; ?>px">
    <?php
    foreach ( $attachments as $attachment_id => $attachment ) {
    	echo "".wp_get_attachment_image( $attachment_id, array(0, 0) )."\n";
    }

    the problem is that they are beeing displayed in reversed order on the site itself.

    btw, I didn’t have this problem when I used WP 2.9

    Thanks,
    Van Zvik

Viewing 1 replies (of 1 total)
  • Thread Starter vanzvik

    (@vanzvik)

    ok, i’ve solved it myself ??

    you must use the ‘order’ parameter and not ‘orderby’:

    $attachments = get_children( array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' =>'image', 'order' => 'ASC') );
    $nbImg = count($attachments);
    foreach ( $attachments as $attachment_id => $attachment ) {
    	echo "".wp_get_attachment_image( $attachment_id, array(0, 0) )."\n";
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Attacments uploaded in reversed order’ is closed to new replies.