简体   繁体   English

将HTML页面插入Wordpress

[英]Insert html pages into wordpress

I have an html site with a page of info for each county in the US. 我有一个html网站,其中包含美国每个县的信息页面。 I want to convert this into a new wordpress site. 我想将其转换为新的wordpress网站。 I can do this one by one but my issue comes when I have mass changes to affiliate code or common text. 我可以一个接一个地做,但是当我对联盟代码或通用文本进行大量更改时,我的问题就来了。 I would have to got to each page and manually change it. 我将不得不进入每个页面并手动更改它。 but with over 3000 pages it would be way to time consuming. 但是如果页面超过3000页,那将是一种耗时的方法。 I dont want to use Iframes but would like to know if there is a way to call the html pages into the wordpress page that makes sense seo wise. 我不想使用iframe,但想知道是否有一种方法可以将html页面称为seo明智的wordpress页面。

I am open to creating a page for each county or have one page with text or buttons on it with each county listed and when clicked will insert the info below. 我愿意为每个县创建一个页面,或者在其中列出每个县的页面上有文本或按钮,单击时将在下面插入信息。 I know alot about static html coding but am new to php. 我对静态html编码了解很多,但对php来说是新知识。

If you dont want Iframes, I think there only remain two options. 如果您不想要iframe,我认为只有两个选择。 I don't know if they will work in WordPress though. 我不知道它们是否可以在WordPress中工作。

1. PHP Include 1. PHP包含

With the very simple PHP include() statement, you can include the old html files in your new website. 通过非常简单的PHP include()语句,您可以在新网站中包含旧的html文件。 If you have a HTML-file for example, name your file yourname.php and add this in the position you want your old page to appear: 例如,如果您有一个HTML文件,则将您的文件命名为yourname.php并将其添加到希望您的旧页面出现的位置:

<?php include(path_to_old_page/name.html); ?>

This will include the full old page, but the file needs to be on the same server. 这将包括完整的旧页面,但是文件必须位于同一服务器上。

2. AJAX 2. AJAX

With JavaScript you can perform XHTTP-requests to load files from the server. 使用JavaScript,您可以执行XHTTP请求以从服务器加载文件。 This is easiest when using jQuery. 这在使用jQuery时最简单。 Here you can use the $(selector).load(path_to_old_page/name.html) statement. 在这里,您可以使用$(selector).load(path_to_old_page/name.html)语句。 This will load the file in the HTML elements to which the selector applies. 这会将文件加载到选择器适用的HTML元素中。

(The selector works the same as CSS selectors, see the w3schools page for more) (选择器的功能与CSS选择器相同,有关更多信息,请参见w3schools页面)

This will also include the full old page, when it is on the same server 当它在同一台服务器上时,还将包括完整的旧页面

You can have your static pages in WordPress as well. 您也可以在WordPress中拥有静态页面。 Like if you want to create a new county named "example" you can create new WordPress page named "example" by entering title " example" .... now come to content. 就像您要创建一个名为“ example”的新县一样,您可以通过输入标题“ example”来创建名为“ example”的新WordPress页面。 Just copy page content (only "example" county related html code from your static website) and place that code inside newly created WordPress "example" page. 只需复制页面内容(仅从静态网站复制“示例”与县相关的html代码),然后将该代码放在新创建的WordPress“示例”页面中即可。 Make sure you add this html content inside 'text' tab in editor. 确保在编辑器的“文本”选项卡中添加此html内容。 Your page will be created with all your existing data ... now you can view this page and can use this page's URL where ever you want. 将使用所有现有数据创建页面...现在,您可以查看此页面,并可以在任何需要的地方使用此页面的URL。

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

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