WordPress 在哪里存储 HTML 页面?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3285767/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where does WordPress store HTML pages?
提问by Al C
I'm new to WordPress, but I've been experimenting with it and I like it.
我是 WordPress 的新手,但我一直在尝试它并且我喜欢它。
So, I'm moving my current site--mostly static HTML files--over to WordPress. My procedure, generally, has been to create new pages in WordPress and then copy the relevant body HTML from my files to WordPress. I'm curious, though, where does WordPress store these pages?
所以,我正在将我当前的站点——主要是静态 HTML 文件——转移到 WordPress。我的程序通常是在 WordPress 中创建新页面,然后将相关正文 HTML 从我的文件复制到 WordPress。不过,我很好奇,WordPress 在哪里存储这些页面?
Where are the file(s) containing the HTML? ... It would be nice to be able to work with the pages someplace other than the tiny editor built into WordPress's dashboard.
包含 HTML 的文件在哪里?... 能够在 WordPress 仪表板中内置的微型编辑器之外的其他地方处理页面会很好。
回答by Pat
They are in WordPress's database, specifically the wp_posts
table, so unfortunately you have to use the admin console editor to change their content.
它们位于 WordPress 的数据库中,特别是wp_posts
表中,因此不幸的是,您必须使用管理控制台编辑器来更改它们的内容。
Update:Another option would be to use the WordPress APIto make changes to the content.
更新:另一种选择是使用WordPress API更改内容。
回答by Matthew P
If you prefer working with the HTML instead of the small editor within the Add new Posts/ Pagessite you can (as a temporary solution) create custom templates for each of your pages just to migrate quickly to WordPress. Afterwards, once that is done, you can create your custom theme and then place this bit of PHP code at the top of each page:
如果您更喜欢使用 HTML 而不是添加新帖子/页面站点中的小型编辑器,您可以(作为临时解决方案)为每个页面创建自定义模板,以便快速迁移到 WordPress。之后,完成后,您可以创建自定义主题,然后将这段 PHP 代码放在每个页面的顶部:
<?php
/**
*
* @package WordPress
* @subpackage THEME_NAME
*
*/
/*
Template Name: THE PAGE NAME
*/
?>
Afterwards, just add a new page and select the template. You don't need to fill out anything in the WordPress administrator page. Once that is done and you get the hang of all of the APIs in WordPress you can properly build your theme so when editing / creating new pages, the HTML is generated automatically. It's a long way around, but it can help you understand how WordPress works. There is a lot of documentation on the wordpres.org website.
之后,只需添加一个新页面并选择模板。您无需在 WordPress 管理员页面中填写任何内容。一旦完成并且您掌握了 WordPress 中的所有 API,您就可以正确构建您的主题,因此在编辑/创建新页面时,会自动生成 HTML。这还有很长的路要走,但它可以帮助您了解 WordPress 的工作原理。wordpres.org 网站上有很多文档。