2012-06-13 70 views
0

我不知道我是不是在這裏,但我有Wordpress的WP_Query問題。我有以下代碼:使用the_title()函數不會顯示在循環中

$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()。任何人都可以看到爲什麼?

+0

你關閉PHP的標籤?> d後有「d」的原因嗎? – Ledgemonkey

+0

請嘗試下面的代碼..看看有什麼出現「全球$後; print_r($後);」你看到正確的職位正確填寫了標題嗎? – FatalError

回答

0

你試過**<?php the_title(); ?>**?我想你錯過了「;」 :)

0

匈奴說,你乾脆忘了;

看看這裏,如果你尋找更多的ressources上Wp Title