我有一个页面模板中的自定义循环,通过给类别和标签按类别显示帖子。它可以工作,但是在循环之上,我需要显示页面本身的内容,即通常输入到Wordpress仪表板的内容。Wordpress显示页面内容和循环?
什么我添加到我的模板来显示此内容?
我曾尝试:
$id = $post->ID;
get_page($id);
// then my custom loop
这确实得到当前页ID,但没有内容。
我有一个页面模板中的自定义循环,通过给类别和标签按类别显示帖子。它可以工作,但是在循环之上,我需要显示页面本身的内容,即通常输入到Wordpress仪表板的内容。Wordpress显示页面内容和循环?
什么我添加到我的模板来显示此内容?
我曾尝试:
$id = $post->ID;
get_page($id);
// then my custom loop
这确实得到当前页ID,但没有内容。
在WordPress中,调用
<?php the_content(); ?>
会从页面上的所见即所得的编辑器,只要它是在循环内正在使用该模板的内容拉。
这样做的最基本的例子可能是这样的:
<?php while (have_posts()) : the_post();/* Start loop */ ?>
<?php the_content(); ?>
<?php endwhile; /* End loop */ ?>
<!-- Enter your custom loop for displaying posts by category down here -->
此处了解详情:http://codex.wordpress.org/Function_Reference/the_content
使用the_content()
函数显示页面的内容。
在此函数调用后添加了您的自定义循环。
谢谢,我不知道我可以简单地比一个循环多! – Steve
没问题。走开! – ReLeaf