图像滑块首先闪烁错误的图像

时间:2013-05-01 03:58:15

标签: html wordpress nivo-slider

我正在使用wordpress主题,Pitch Pro,它有一个内置滑块。我的问题是,有时滑块会闪烁错误的图像一秒钟。我注意到它不能正常工作,但只有当我从支持页面转到主页时才会这样做。我尝试过更改并设置顺序。更改幻灯片的最大数量,目前为6,但似乎没有任何解决方法。

如果有人对修复有任何疑问,该网站目前是jrummy16.com/test。

不确定这是否与它有关但是我使用的服务器有问题并且修复它hostgator告诉我添加define('CONCATENATE_SCRIPTS',false);到我的config.php文件。它解决了这个问题,但在添加之前我不记得滑块有这个问题。

我不知道如何开始对此进行故障排除。所以任何帮助将不胜感激。

修改 所有文件都在主题Pitch Pro中找到。

我打开了我的home.php文件,我在滑块顶部找到了这个。

<?php
    $slider_template = apply_filters('pitch_slider_template', array('slider', null));   
    get_template_part( $slider_template[0], $slider_template[1] );
?>

然后我去了同一个文件夹中打开了slider.php。它有这个代码,

<?php

$slides = new WP_Query(array(
    'numberposts' => siteorigin_setting('slider_max_slides'),
    'nopaging'     => true,
    'post_type' => 'slide',
    'orderby' => 'menu_order',
    'order' => 'ASC'
));

if($slides->have_posts()){
    ?>
    <div id="slider">
        <div class="container">
            <div class="slides nivoSlider">
                <?php while ($slides->have_posts()) : $slides->the_post(); if(has_post_thumbnail()) :  ?>

                    <?php if(get_post_meta(get_the_ID(), 'slide_destination', true)) : $destination = get_post_meta(get_the_ID(), 'slide_destination', true) ?>
                        <?php echo '<a href="'.esc_url(get_permalink($destination)).'" title="'.esc_attr(get_the_title($destination)).'">' ?>
                    <?php elseif(get_post_meta(get_the_ID(), 'slide_destination_url', true)) : $destination = get_post_meta(get_the_ID(), 'slide_destination_url', true) ?>
                        <?php echo '<a href="'.esc_url($destination).'">' ?>
                    <?php endif; ?>
                    <?php echo get_the_post_thumbnail(get_the_ID(), 'slide') ?>
                    <?php if(!empty($destination)) echo '</a>' ?>
                <?php endif; endwhile; ?>
            </div>

            <?php $slides->rewind_posts(); ?>

            <div class="indicators-wrapper">
                <ul class="indicators">
                    <?php while ($slides->have_posts()) : $slides->the_post(); if(has_post_thumbnail()) :  ?>
                    <li class="indicator <?php if($slides->current_post == 0) echo 'active' ?> indicator-group-<?php echo $slides->post_count ?>">
                        <div class="indicator-container">
                            <div class="pointer"></div>
                            <h4><?php the_title() ?></h4>
                            <?php the_excerpt() ?>
                        </div>
                    </li>
                    <?php endif; endwhile; ?>
                </ul>
            </div>
        </div>
    </div>
    <?php
    wp_reset_postdata();
}

我不确定这是否会有所帮助,但我希望确实如此。

1 个答案:

答案 0 :(得分:1)

我认为原因是在滑块完全加载之前,页面会在幻灯片列表中显示最后一张图片,在您的情况下,它就是这一张:

<img width="705" height="344" src="http://jrummy16.com/test/wp-content/uploads/BA-slider.jpg" class="attachment-slide wp-post-image" alt="BA-slider">

这是一个similar problem,你可以使用它的解决方案很少。

更新:

我发现这个article建议修改你的CSS。我会在这里粘贴代码,但文章使用图像来显示CSS代码:)

相关问题