大家好日子,WordPress的具體內容
我是新的WordPress的。我想問一下如何在不同div中顯示我的頁面內容。但是當我嘗試這個代碼。它不會顯示任何內容,我的頁面甚至不會加載。任何幫助將非常感激。謝謝!
<?php if($_SERVER['REQUEST_URI'] == '/wordpress/?page_id=5'): ?>
<div style="width:960px; float:left;min-height:290px;word-wrap: break-word">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('content', 'page'); ?>
<?php endwhile; // end of the loop. ?>
</div>
<?php else: ?>
<div style="width:640px; float:left;min-height:290px;word-wrap: break-word">
<?php while (have_posts()) : the_post(); ?>
<?php get_template_part('content', 'page'); ?>
<?php endwhile; // end of the loop. ?>
</div>
<?php endif;?>
看起來有一個缺少'<?php endif;在最後打開'display_errors',你會看到語法錯誤。 '的error_reporting(E_ALL); ini_set('display_errors',1);' – 2013-02-11 13:57:53
我編輯了你的問題,然後添加了最後一行'<?php endif; ?>'。 – 2013-02-11 13:58:03
@RubensMariuzzo但這可能是OP的頁面無法加載的原因。直到OP確認它不在那裏,您才能添加它。 – 2013-02-11 13:59:16