【问题标题】:Get Nivo Slider Current slide title获取 Nivo Slider 当前幻灯片标题
【发布时间】:2011-04-26 22:52:23
【问题描述】:

有没有办法获取 Nivo Slider 的当前幻灯片“标题”并将其显示在另一个 div 中?

【问题讨论】:

    标签: wordpress nivo-slider


    【解决方案1】:

    从 wp-nivo-slider.php 的第 209 行开始

    变化:

    <div id="slider">
    <?php 
                $category = get_option('wpns_category');
           $n_slices = get_option('wpns_slices');
    ?>
        <?php query_posts( 'cat='.$category.'&posts_per_page=$n_slices' ); if( have_posts() ) : while( have_posts() ) : the_post(); ?>
            <?php if(has_post_thumbnail()) : ?>
            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                        <?php the_post_thumbnail(); ?>
            </a>
            <?php endif ?>        <?php endwhile; endif;?>        <?php wp_reset_query();?>
        </div>
    

    收件人:

    <div id="slider" style="position:relative;">
    query_posts( 'cat='.$category.'&posts_per_page=$n_slices' ); if( have_posts() ) : while( have_posts() ) : the_post(); ?>
           <?php if(has_post_thumbnail()) : ?>
            <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                    <?php the_post_thumbnail(); ?>
                </a>
        <div id="slider-title" style="position:absolute; background-image:rgba(0, 0, 0, .5); color:#fff!important; top:10px; left:5px; display:block;"><?php the_title(); ?></div>
                    <?php endif ?>
            <?php endwhile; endif;?>
                <?php wp_reset_query();?>
    </div>
    

    这会将标题放在图像的左上角,背景为半透明。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-02-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多