简体   繁体   English

在wordpress中插入一个html页面

[英]Inserting an html page in wordpress

I have a page I've developed in html and javascript, but I need to integrate it in a site developed in wordpress. 我有一个用html和javascript开发的页面,但是我需要将其集成到使用wordpress开发的站点中。

Is there a way to do it? 有办法吗?

Thanks fo all the help! 感谢所有帮助!

Yes, but it isn't going to be particularly quick or easy. 是的,但这并不会特别快捷或容易。 You need to either take the existing template files and integrate them with your HTML/CSS/JS, or create a new theme from scratch. 您需要获取现有模板文件并将其与HTML / CSS / JS集成,或者从头开始创建新主题。 Essentially, this entails creating a bunch of templates and adding PHP template tags that are used by Wordpress to display content, etc. 从本质上讲,这需要创建一堆模板,并添加Wordpress用于显示内容等的PHP模板标签。

Helpful links from the Wordpress Codex : 来自Wordpress Codex的有用链接:

IMO, the best way to go about this is to take your front end template code (the HTML, CSS, JS you wrote) and use it as a base for writing a Wordpress theme from scratch. IMO,最好的方法是获取您的前端模板代码(您编写的HTML,CSS,JS),并将其用作从头开始编写Wordpress主题的基础。 ThemeShaper has a fantastic and in-depth "write a Wordpress theme from scratch" tutorial which you can find here . ThemeShaper提供了一个精彩而深入的“从头开始编写Wordpress主题”教程, 您可以在这里找到

It might take a bit longer than hacking your code into whatever existing theme the site is using, but it will be much cleaner and you will learn much, much more in the process. 与将您的代码破解成网站正在使用的任何现有主题相比,这可能需要更长的时间,但是这样做会更加简洁,您将在此过程中学到很多东西。

Edit: Just saw your comments - you should have specified that you are not creating a new theme from your template but just want to put that single page into a pre-existing theme in the first place. 编辑:刚看到您的评论 -您应该指定您不是从模板创建新主题,而只是想将单个页面放在第一位预先存在的主题中。 In that case, it really depends on what you mean by "integration". 在那种情况下,它实际上取决于您所说的“集成”。 If your page doesn't need to access any WP functions or database info, you can just upload it and interlink it from the other pages. 如果您的页面不需要访问任何WP函数或数据库信息,则可以将其上传并与其他页面互连。

If you do need WP functions, there are a few options: 如果确实需要WP函数,则有以下几种选择:

  • Create a new page template for that page only, and use your HTML/CSS/JS on that page (copy the basic page template, rename it and edit as needed... see links for details). 仅为该页面创建一个新页面模板,然后在该页面上使用您的HTML / CSS / JS(复制基本页面模板,对其进行重命名并根据需要进行编辑...有关详细信息,请参见链接)。 Then you can add whatever WP functions you want... depending on how different the page is from the rest of the theme, you probably need to copy header.php and footer.php into the page template and edit them as well rather than including the default ones. 然后,您可以添加所需的任何WP函数...根据页面与主题其余部分的不同之处,您可能需要将header.php和footer.php复制到页面模板中并进行编辑,而不是包括默认的。
  • Upload it as a separate page, then require wp-load.php or wp-blog-header.php in the header to load Wordpress core. 将其上传为单独的页面,然后在标题中要求wp-load.phpwp-blog-header.php才能加载Wordpress核心。 See this WordPress Answers post for details. 有关详细信息,请参见WordPress答案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM