我有
<?php while ( have_posts() ) : the_post(); ?>
<div class="boxes-third boxes-first">
<div class="latestthree">
<div class="title">
<?php get_the_title($id); ?> // I am trying to get the post title here but doesn't work
<span class="titlearrow"></span>
</div>
<div class="latestthreeimage">
<a rel="prettyPhoto" title="<?php get_the_title($id); ?>"> /same here
<?php the_post_thumbnail(array(300,133)); ?>
</a></div>
<div class="text">
Here i would like to get the excerpt of the post that is no longer than 25 words
<span class="textarrow"></span>
</div>
</div>
</div>
<?php endwhile; ?>
我正在尝试执行上述操作,但是没有用,在最后一个没有找到相关信息。我正在使用wp 3.7.1。请帮我。
最佳答案
您使用了不打印的get_the_title()
。要打印标题,请添加额外的echo
:
<?php echo get_the_title(); ?>
或者,您可以使用
the_title()
,它还会打印:<?php the_title();?>
关于php - 在while循环中获取索引php中的帖子标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19856105/