关闭。这个问题不满足Stack Overflow guidelines .它目前不接受答案。
想改善这个问题吗?更新问题,使其成为 on-topic对于堆栈溢出。
3年前关闭。
Improve this question
我知道我的 Wordpress 主页有一个静态页面。我还有一个名为“Rate Entries”的页面作为我的博客页面。在向我的客户展示了这个,然后向她展示了 Wordpress 的管理部分后,她开始在 中输入一个段落。页面>>所有页面>>“评价条目”>>编辑 .
众所周知,这里的大问题是,如果“评分条目”是我的帖子页面,则该页面内容不会显示在那里,只显示帖子。有没有办法将该页面内容添加到帖子页面的顶部?我曾希望找到一个插件来做到这一点,但无济于事。
最佳答案
假设您已经为 Wordpress 后端(设置 > 阅读)中的帖子设置了自定义页面,您只需要在 中添加几行代码即可。 index.php 文件中的主题。像这样:
//grab the id of the page set in the backend
$posts_page_id = get_option('page_for_posts');
//grab the post object related to that id
$posts_page = get_post($posts_page_id);
//display the content if any
if( $posts_page->post_content ){
echo wpautop( $posts_page->post_content ); //uses wpautop to automatically add paragraphs
}
在您的情况下,您可以添加代码以显示此代码下方的循环。
希望这可以帮助!
关于wordpress - 将静态内容添加到 Wordpress 帖子页面?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13589288/