页面内容未在wordpress上显示
问题描述:
您使用什么样的WordPress功能来显示页面内容?页面内容未在wordpress上显示
I used the_content to show the post contents, but what about the page contents?
我已经尝试了一切,但我还没有找到显示WordPress的页面内容的功能。
而且,我已经创建了一个基本的page.php文件文件,并在文件中我有:
<div id="pages">
<li><?php wp_list_pages() ?></li>
</div>
Now, why do my index.php have my list of pages even though I didn't use the inlcude or require function?
记住我创建了自己的主题和网站,我试图把它WordPress的第一次。
谢谢!
答
功能wp_list_pages()
列出了所有页面。如果要列出所有的最新文章,你应该使用
的index.php
<?php get_header(); ?>
<?php while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="entry-content">
<?php the_content(); ?>
</div>
</div>
<?php endwhile; // end of the loop. ?>
<?php get_sidebar(); // If you have sidebar ?>
<?php get_footer(); ?>
page.php文件
<?php get_header(); ?>
<?php if (have_posts()) while (have_posts()) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<div class="entry-content">
<?php the_content(); ?>
</div>
</div>
<?php endwhile; // end of the loop. ?>
<?php get_sidebar(); // If you have sidebar ?>
<?php get_footer(); ?>
请务必检查默认twentyeleven
和twentyten
主题了解如何编码WordPress主题。
谢谢!有效! – FNMT8L9IN82 2012-01-01 04:28:54