WordPress的/ PHP的 - 如何显示页面描述

问题描述:

我是新来的WordPress的模板编辑,我试图让页面描述显示在我的网站上,但它并没有出现。我试图去显示说明的URL是在这里:WordPress的/ PHP的 - 如何显示页面描述

http://fourwallsla.com/category/the-neighborhood/east-side/

,我已经把它贴WordPress的内页介绍的截图。它似乎在使用存档模板(为什么它不使用页面模板?)。

下面是一些存档模板的代码:

<div class="main"> 
<?php if (have_posts()) : $first = true; ?> 
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> 
    <?php /* If this is a category archive */ if (is_category()) { ?> 
     <h1><?php single_cat_title(); ?></h1> 
    <?php /* If this is a tag archive */ } elseif(is_tag()) { ?> 
     <h1><?php single_tag_title(); ?></h1> 
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?> 
     <h1><?php echo get_the_time('F jS, Y'); ?></h1> 
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> 
     <h1><?php echo get_the_time('F, Y'); ?></h1> 
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> 
     <h1><?php echo get_the_time('Y'); ?></h1> 
    <?php /* If this is an author archive */ } elseif (is_author()) { ?> 
     <h1><?php _e('Author Archive', 'gray_white_black'); ?></h1> 
    <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> 
     <h1><?php _e('Blog Archives', 'gray_white_black'); ?></h1> 
    <?php } ?> 

    <ul class="post-list"> 
    <?php while (have_posts()) : the_post(); 

其中,在上面的代码,the_post(),适度,是指在网页上显示的类别中的家上市的内容。但是,如何获取页面本身的the_post(),如截图所示?谢谢。

enter image description here

+0

恕我直言,你这样做是错误的模板:点击这里http://codex.wordpress.org/ Template_Hierarchy – Sergey

+0

对我来说也是如此,但我没有构建主题,我想避免更改模板,因为其他一切都是我的朋友在她的网站上需要的方式。 – mheavers

它使用archive.php模板,因为你检索类别中的所有帖子 - “邻里” &“东城”。如果你想让它使用默认的page.php,你将不得不在Wordress中发布一个页面。 要打印的说明(“考试说明”)或帖子的内容,之后添加<?php the_content(); ?><?php the_excerpt(); ?>

<?php while (have_posts()) : the_post(); 
+0

谢谢 - 我的网页已经发布。这就是添加了“测试说明”的地方 - 所以我仍然对做什么感到困惑。我已经想出了一个解决方法,但它是硬编码的,所以它不是理想的。我安装了一个名为“改进的包含页面”的插件,该插件允许您使用其ID来输出任何模板中的页面内容。所以我写了一个switch语句switch($ catName){case“east side”:iinclude_page(17);打破;我想找到一个动态的方法来做到这一点。 – mheavers

+0

如果您已经发布了该页面,请转到Wordpress,然后点击查看页面。它的永久链接会有所不同,它的名称中不会有/分类。/category正在使Wordpress加载archive.php – anuragbh

+0

我刚刚在上面的截图中注意到,你在“永久链接”中有“/ category /”。编辑它,并给它一个镜头。它应该加载page.php模板。 – anuragbh