Wordpress 静态页面:如何将内容嵌入到模板中? [英] Wordpress static pages: how to embed content into templates?
问题描述
我正在尝试将主要静态站点转换为 wordpress,以了解站点所有者更改页面的难易程度.我已将所有内容复制到 Theme 文件夹并创建了页眉和页脚模板,预览效果很好.然后我继续创建一个新页面并添加一些内容(页面/添加新)并将模板附加到页面(属性/模板下拉列表).我的问题是如何将输入到新页面或编辑过的页面中的内容嵌入到所选模板中?
I'm trying to convert a primarily static site to wordpress to see how easy it is for the site owner to make changes to the pages. I've copied everything to the Theme folder and created the header and footer templates, and the preview looks fine. I then went on to create a new page and add some content (Pages/Add New) and attached a template to the page (Attribute/Template dropdown). My question is how does the content entered into a new or edited page get embeded into the selected template?
感激地接受任何帮助,谢谢
Any help gratefully accepted, Thanks
推荐答案
网站所有者可以在 Wordpress 内编辑静态页面.您是否缺少模板页面中的循环?除非 WP 循环在模板文件中,否则在 wordpress 编辑器中输入的任何内容都不会以静态页面结束:
A static page can be edited by the site owner inside of Wordpress. Are you missing the loop in your template pages? Nothing entered in the wordpress editor will end up on a static page unless the WP loop is in the template file:
<?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>
<?php the_content(); ?> //this is how the content shows up
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
这篇关于Wordpress 静态页面:如何将内容嵌入到模板中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!