0

WordPress でテンプレートを編集するのは初めてで、自分のサイトにページの説明を表示しようとしていますが、表示されません。説明を表示するために取得しようとしている URL は次のとおりです。

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() を取得するにはどうすればよいでしょうか? ありがとう。

ここに画像の説明を入力

4

1 に答える 1

1

'In The Neighborhood' & 'East Side' というカテゴリ内のすべての投稿を取得しているため、archive.php テンプレートを使用しています。デフォルトの page.php を使用する場合は、Wordress でページを公開する必要があります。説明 (「テストの説明」) または投稿の内容を印刷するには、<?php the_content(); ?>またはの<?php the_excerpt(); ?>後に次を追加します。

<?php while (have_posts()) : the_post();
于 2012-05-23T17:00:47.273 に答える