-1

Hi i have this code implemented into my wordpress theme?

The code is made to automatically pull all images that are attached to the post, It does just that but it aligns all images underneath one another where do i begin to style this so that the images will appear side by side?

here is the code.

<?php

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

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 wp_get_attachment_link( $attachment->ID, 'full' , false, false, '' );
}
}

?>
4

1 回答 1

0

使用 google chrome 的检查器或 Firefox 的 Firebug 扩展来查看你的图像上放置了什么样的类。然后在您的主题中编辑 style.css 以进行必要的更改。根据您使用的插件,您可能可以更改类甚至与插件代码的对齐方式,但也没有理由不在 css 中执行此操作。

于 2012-08-02T14:16:21.547 回答