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.

Ok so i am using this code, which allows me to upload photo's to a post and instead of inserting them myself, it calls all the photos attached to the post. Thus for placing all the photos in the post by itself. But what i did was made this page int a gallery where i use a jquery jcarousel where they can click the arrows to go to the next photo.

here is the code

 <?php

if ( 'photos' == get_post_type() ) { //condition to show gallery on post type - photos

if ( $attachments = get_children( array(
    'post_type' => 'attachment',
    'post_mime_type'=>'image',   //return all image attachment only
    'numberposts' => -1,   //get all the attachments
    'post_parent' => $post->ID
)));

foreach ($attachments as $attachment) {
    // you can customize the oputput
    echo '<li><center>';
    echo wp_get_attachment_link( $attachment->ID, 'full' , false, false, '' );
    echo '<span class="img_cap">'.$attachment->post_excerpt.'</span>';
    echo '</center></li>';
}
}

?>

But how do i get the post_excert part of the code which is the caption, to align left of the image, what do i add to the code and where, or is this something i do in css.

share|improve this question
    
Is it currently to the right of the image? –  w3d Aug 14 '12 at 23:52
    
No it's not aligned at all, but i want it to be –  Terrell Anderson Aug 14 '12 at 23:59
    
Ok, this is a guess (hence not an answer)... swap the echo '<span... and echo wp_get_attachment_link(... lines around. To the span line add a style attribute: echo '<span style="float:left;margin-right:1em" class=... –  w3d Aug 15 '12 at 0:15
    
that didn't work –  Terrell Anderson Aug 15 '12 at 3:28
1  
As you suggest, this is something you would ordinarily do in your CSS. The only query is whether this would require a structural change to the HTML markup. –  w3d Aug 15 '12 at 7:04
add comment

closed as off topic by Michael, kaiser, toscho Oct 3 '12 at 0:22

Questions on WordPress Development Stack Exchange are expected to relate to WordPress within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.