Добавить заголовок сообщения в Nivo-Slider для WordPress - PullRequest
0 голосов
/ 30 августа 2011

Я пытаюсь отредактировать Nivo-Slider в моем блоге WordPress - в настоящее время он отображает заголовок изображения. Я бы хотел, чтобы он отображал заголовок поста, вот код для слайдера:

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

1 Ответ

0 голосов
/ 30 августа 2011

Просто используйте <?php the_title(); ?> снова:

<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>
...