-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 に答える