Wordpress Slider PHP在缩略图中添加标题

时间:2014-05-28 13:56:42

标签: javascript php jquery wordpress slider

我正在使用Tie Labs的Wordpress模板“Sahifa”,他们的支持论坛没有回答任何自定义问题,所以我想在这里寻求帮助。我通常使用HTML / CSS,对PHP来说相对较新。

在滑块内,底部有缩略图按钮,您可以点击它们,我们希望它可以调用标题所提取的相同标题信息。我似乎正在查看<li>和“slider-thumbs”区域。我认为这是代码中应该进行更改的部分:

<?php if( $slider_query != 'custom' ): ?>       
<?php if( $featured_query->have_posts() ) : ?>
<div id="ei-slider" class="ei-slider">
    <ul class="ei-slider-large">
    <?php $i= 0;
        while ( $featured_query->have_posts() ) : $featured_query->the_post(); $i++; ?>
        <li>
        <?php if ( function_exists("has_post_thumbnail") && has_post_thumbnail() ) : ?>
            <a href="<?php the_permalink(); ?>"><?php tie_thumb( $size ); ?></a>
        <?php endif; ?>
            <div class="ei-title">
                <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
                <?php if (tie_get_option( 'slider_caption' )) : ?><h3><?php echo tie_content_limit( get_the_excerpt() , $caption_length ) ?></h3><?php endif; ?>
            </div>
        </li>
    <?php endwhile;?>
    </ul>
     <ul class="ei-slider-thumbs">
        <li class="ei-slider-element">Current</li>
    <?php $i= 0;
        while ( $featured_query->have_posts() ) : $featured_query->the_post(); $i++; ?>
        <li><a href="#">Slide <?php echo $i; ?><?php tie_thumb( 'tie-medium' ); ?></a></li>
        <?php endwhile;?>
    </ul><!-- ei-slider-thumbs -->
</div>
<?php endif; ?>

如何处理?

1 个答案:

答案 0 :(得分:0)

如果你想要输出帖子的标题,你可以简单地使用wordpress功能 the_title()

<?php echo the_title(); ?>

你可以在while函数的任何地方使用它,从这开始:

<?php $i= 0;
    while ( $featured_query->have_posts() ) : $featured_query->the_post(); $i++; ?>

以此结束:

<?php endwhile; ?>
相关问题