使用the_title()函数不会在循环中显示

时间:2012-06-13 12:05:28

标签: wordpress

我不知道我是否在这里,但是我遇到了Wordpress的WP_Query问题。我有以下代码:

$the_query = new WP_Query();
$the_query->query('post_type=property');

// The Loop
while ( $the_query->have_posts() ) : $the_query->the_post();
    ?>

    <div class="featured">
        <h1><?php the_title()  ?>d</h1>
        <!--<ul>
            <li>3 Bedrooms</li>
            <li>Large Garden</li>
            <li>Walking distance to shops</li>
            <li>Semi-Detached</li>                                
        </ul>-->
        <a href="#" class="more-info">More details</a>
    </div>

    <?php
endwhile;

它正确找到3个帖子,但它没有显示the_title()。任何人都可以看到原因吗?

2 个答案:

答案 0 :(得分:0)

你试过**<?php the_title(); ?>**吗?我想你错过了“; ”:)

答案 1 :(得分:0)

就像匈奴所说,你只是忘了;

如果您在Wp Title

上寻找更多资源,请查看此处
相关问题