我如何设计这个画廊?

时间:2012-08-02 13:22:21

标签: php css photo-gallery

嗨,我已将此代码实现到我的wordpress主题中?

代码是为了自动拉出附在帖子上的所有图像,它就是这样但是它将所有图像对齐在一起,我在哪里开始设计这样的图像以便图像并排出现?

这是代码。

<?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, '' );
}
}

?>

1 个答案:

答案 0 :(得分:0)

使用谷歌浏览器的检查器或Firefox的Firebug扩展程序来查看图像上放置的类。然后编辑主题中的style.css以进行必要的更改。根据您使用的插件,您可以更改类甚至与插件代码对齐,但也没有理由不在css中执行此操作。

相关问题