0

目前我的图片库每行有 4 张图片。如果屏幕被最小化到这 4 个图像的宽度以下,一个图像将下降到下一行,并且在下一行之前会有一个换行符。有没有办法让画廊连续而不是在调整屏幕大小时中断图像?理想情况下,我想从每行 5 张图像开始,然后如果查看器的屏幕较小,它将自动调整每行图像的数量以适应他们使用的任何大小的窗口。

这是画廊的链接:http ://rabbittattoo.com/?gallery=gallery

和 PHP:

$pp_gallery_style = get_option('pp_gallery_style');
if($pp_gallery_style == 'f')
{
include_once(TEMPLATEPATH.'/gallery-f.php');
exit;
}

if(!isset($hide_header) OR !$hide_header)
{
get_header(); 
}

$caption_class = "page_caption";
$portfolio_sets_query = '';
$custom_title = '';

if(!empty($term))
{
$portfolio_sets_query.= $term;

$obj_term = get_term_by('slug', $term, 'photos_galleries');
$custom_title = $obj_term->name;
}
else
{
$custom_title = get_the_title();
}

/**
*   Get Current page object
**/
$page = get_page($post->ID);

/**
*   Get current page id
**/

if(!isset($current_page_id) && isset($page->ID))
{
$current_page_id = $page->ID;
}

if(!isset($hide_header) OR !$hide_header)
{
?>              
    <div class="wrapper_shadow"></div>
    <div class="page_caption">
        <div class="caption_inner">
            <div class="caption_header">
                <h1 class="cufon"><?php echo the_title(); ?></h1>
            </div>
        </div>
    </div>

    </div>

    <!-- Begin content -->
    <div id="content_wrapper">

        <div class="inner">

            <!-- Begin main content -->
            <div id="gallery_wrapper" class="inner_wrapper portfolio">

            <div class="standard_wrapper small">
                <br class="clear"/><br/>


<?php
}
else
{
echo '<br class="clear"/>';
}
?>  

                    <?php echo do_shortcode(html_entity_decode($page->post_content)); ?>

                    <!-- Begin portfolio content -->

                    <?php
                        $menu_sets_query = '';

                        $portfolio_items = 0;

                        $portfolio_sort = get_option('pp_gallery_sort'); 
                        if(empty($portfolio_sort))
                        {
                            $portfolio_sort = 'DESC';
                        }

                        $args = array( 
                            'post_type' => 'attachment', 
                            'numberposts' => $portfolio_items, 
                            'post_status' => null, 
                            'post_parent' => $post->ID,
                            'order' => $portfolio_sort,
                            'orderby' => 'date',
                        );                              
                        $all_photo_arr = get_posts( $args );

                        if(isset($all_photo_arr) && !empty($all_photo_arr))
                        {

                    ?>

                                        <?php

                                            foreach($all_photo_arr as $key => $portfolio_item)
                                            {

                                                $image_url = '';

                                                if(!empty($portfolio_item->guid))
                                                {
                                                    $image_id = $portfolio_item->ID;
                                                    $image_url[0] = $portfolio_item->guid;
                                                }

                                                $last_class = '';
                                                $line_break = '';
                                                if(($key+1) % 4 == 0)
                                                {   
                                                    $last_class = ' last';

                                                    if(isset($page_photo_arr[$key+1]))
                                                    {
                                                        $line_break = '<br class="clear"/><br/>';
                                                    }
                                                    else
                                                    {
                                                        $line_break = '<br class="clear"/>';
                                                    }
                                                }

                                        ?>
                                                        <div class="one_fourth<?php echo $last_class?>" style="margin-right:24px;margin-bottom:24px;margin-top:-20px">
                                                            <a title="<?php echo $portfolio_item->post_title?>" href="<?php echo $image_url[0]?>" class="one_fourth_img" rel="gallery" href="<?php echo $image_url[0]?>">
                                                                <img src="<?php echo get_stylesheet_directory_uri(); ?>/timthumb.php?src=<?php echo $image_url[0]?>&h=370&w=350&zc=1" alt=""/>
                                                            </a>
                                                        </div>

                                        <?php

                                                echo $line_break;
                                            }
                                            //End foreach loop

                                        ?>

                        <?php

                        }
                        //End if have portfolio items
                        ?>


                    </div>
                    <!-- End main content -->

                <br class="clear"/><br/>

            </div>

<?php
if(!isset($hide_header) OR !$hide_header)
{
?>              

    </div>
    <!-- End content -->


<?php get_footer(); ?>
<?php
}
?>

提前感谢您的帮助!

4

0 回答 0