【问题标题】:Add post title to Nivo-Slider for wordpress将帖子标题添加到用于 wordpress 的 Nivo-Slider
【发布时间】:2011-08-30 13:53:27
【问题描述】:

我正在尝试在我的 wordpress 博客上编辑 Nivo-Slider - 它当前显示图像标题。我希望它显示帖子标题,这是滑块的代码:

<div id="slider">
<?php 
$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(); ?> <!--Want to display Post Title here-->
</a>
<?php endif ?>
<?php endwhile; endif;?>
<?php wp_reset_query();?>
</div>

【问题讨论】:

    标签: jquery wordpress nivo-slider


    【解决方案1】:

    再次使用&lt;?php the_title(); ?&gt;

    <div id="slider">
    <?php 
    $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(); ?> <?php the_title(); ?>
    </a>
    <?php endif ?>
    <?php endwhile; endif;?>
    <?php wp_reset_query();?>
    </div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-10-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多