Wordpress的具体内容

时间:2013-02-11 13:54:33

标签: php 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;?>

1 个答案:

答案 0 :(得分:0)

如果您有权访问主题文件,请复制并粘贴page.php,将重复的文件重命名为page-about.php,其中about是页面的标题。同样,您可以拥有任意数量的page重复项。

要查找页面的标记,请转到page editing区域,Screen Option&gt; View Slug