Wordpress/PHP-如何显示页面描述

Wordpress/PHP-如何显示页面描述,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我是wordpress中模板编辑的新手,我试图在我的网站上显示一个页面描述,但它没有出现。我试图获取的用于显示描述的URL如下所示: 我已经在wordpress中附上了页面描述的截图。它似乎正在使用归档模板(为什么不使用页面模板?) 以下是存档模板的一些代码: <div class="main"> <?php if (have_posts()) : $first = true; ?> <?php $post = $posts[0]; // Hack. Se

我是wordpress中模板编辑的新手,我试图在我的网站上显示一个页面描述,但它没有出现。我试图获取的用于显示描述的URL如下所示:

我已经在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();


    它使用的是archive.php模板,因为您正在检索类别“In the neighbor”和“East Side”中的所有帖子。如果希望它使用默认的page.php,则必须在Wordress中发布页面。 要打印描述(“测试描述”)或文章内容,请在以下内容后添加

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

    IMHO,你做得不对模板:检查这里对我来说也是这样,但我没有构建主题,我想避免更改模板,因为其他一切都是我朋友希望她在网站上发布的方式。谢谢-我确实发布了页面。这就是添加“测试描述”的地方——所以我仍然有点困惑该怎么做。我已经想出了一个解决办法,但它是硬编码的,所以并不理想。我安装了一个名为“改进的包含页面”的插件,它允许您使用页面ID在任何模板中输出页面内容。因此我写了一个switch语句,说switch($catName){case“east side”:iinclude_Page(17);break;我想找到一个动态的方法来实现这一点。如果你发布了页面,请转到Wordpress,然后单击查看页面。它的永久链接将不同,它的名称中不会有/category。/category正在使Wordpress加载存档。phpI刚刚在上面的屏幕截图中注意到,你有/category/“在permalink中。编辑它,并给它一个镜头。它应该加载page.php模板。啊,好的-如果我这样做,我仍然可以在页面模板中显示类别,对吗?当然。要在这些类别中列出帖子,只需在循环之前指定要查询的catid。