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


Wordpress Slider PHP adding Title in thumbnail

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

在滑块的底部有缩略图按钮,你可以点击,我们希望它调用相同的标题信息,标题是拉。从我所能看到的来看,我似乎会在<li>和"滑动拇指"区域寻找。我认为应该在代码的这一部分进行修改:

<?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; ?>

如何处理这个问题?

如果你想输出文章的标题,你可以简单地使用wordpress函数the_title()

<?php echo the_title(); ?>

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

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

并以如下结尾:

<?php endwhile; ?>