如何在wordpress中将页面特色图像添加到nivo滑块?

时间:2015-01-26 14:56:01

标签: wordpress nivo-slider

我按照以下指南尝试手动将nivo滑块安装到Wordpress中:http://www.aoclarkejr.com/author/aj/

我正在尝试让滑块拾取并显示特色图像。我想也许第6步中的代码存在问题,而不仅仅是缺失的'(见下文)。由于滑块似乎正在加载,即我获得了下一个/ prev选项卡,并且在查看页面源时可以看到代码,但它没有拾取并显示特色图像。

 <div id="slider-wrap">
    <div id="slider">
    <?php query_posts(array(
    'post_type'=>'slides
    ));
    ?>
<?php if ( have_posts() ) while ( have_posts() ) : the_post();
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
?>
<img src="<?php echo $thumbnail[0]; ?>" width="" height="" />
<?php endwhile; ?>
</div><!--/slider nivoSlider-->
</div><!--/slider-wrap -->

我应该补充一点,我试图让它在页面上工作,而不是自定义帖子。 我的最终目标是获得与此相同的实现:http://pexetothemes.com/demos/story_wp/home-default/

现在是我的代码:

<?php get_header(); ?>

<div class="header-wrapper">
<div id="slider-wrap">
<div id="slider">
<?php query_posts(array(
'post_type'=>'page'
));
?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(), 'large');
?> <img src="<?php echo $thumbnail[0]; ?>" width="" height="" /> 
<?php // endwhile; ?>
</div><!--/slider nivoSlider-->
</div><!--/slider-wrap -->


</div>  
        <div class="clear"></div>

        <div id="content-container" class="content-boxed layout-full">
            <div id="full-width" class="content">
                <div class="content-box">
                    <?php the_content(); ?> 
                </div>
            </div>
        </div>      

        <?php endwhile; else : ?>
    <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p>
<?php endif; ?>

        </div><!-- page wrapper --> 

<?php get_footer(); ?>

由于某种原因,页面的一部分正在重复。

       <div class="header-wrapper"></div>
        <div id="slider-wrap">
            <div id="slider">
                <img width="" height="" src="http://localhost:8888/defylife/assets/images/posts/ccm_adventure_450gp_left.jpg"></img>
            </div>
            <!--

            /slider nivoSlider

            -->
        </div>
        <!--

        /slider-wrap 

        -->
        <div class="clear"></div>
        <div id="content-container" class="content-boxed layout-full">
            <div id="full-width" class="content">
                <div class="content-box"></div>
            </div>
        </div>
        <img width="" height="" src=""></img>
    </div>
    <!--

    /slider nivoSlider

    -->

</div>
<!--

/slider-wrap 

--> 

0 个答案:

没有答案
相关问题