简体   繁体   中英

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.

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. Essentially, this entails creating a bunch of templates and adding PHP template tags that are used by Wordpress to display content, etc.

Helpful links from the 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. ThemeShaper has a fantastic and in-depth "write a Wordpress theme from scratch" tutorial which you can find here .

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.

If you do need WP functions, there are a few options:

  • 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). 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.
  • Upload it as a separate page, then require wp-load.php or wp-blog-header.php in the header to load Wordpress core. See this WordPress Answers post for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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