【问题标题】:How do i style this gallery?我如何设计这个画廊?
【发布时间】:2012-08-02 13:22:21
【问题描述】:

您好,我在我的 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, '' );
}
}

?>

【问题讨论】:

  • 信息不足。插件叫什么?我们可以看到生成的 HTML 吗?以及相关的 CSS?

标签: php css photo-gallery


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2023-03-12
    • 2021-05-21
    • 2022-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-01-27
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多