将HTML页面添加到WordPress
问题描述:
在我的网站中,我将其转换为WordPress CMS主题,其中有7个菜单选项可用于各个HTML页面。将HTML页面添加到WordPress
我的问题是,将这7个html页面放到我的WordPress CMS主题中的最佳方式是什么,即是否存在后端,或者是否将这些单独页面直接添加为WordPress管理员?
我目前有我的菜单选项的设置如下:
<li><a href="index.html" class="topm currentMenu nosub">Home</a></li>
<li><a href="about-us.html" class="topm nosub">About Us</a></li>
而且,我怎么联系我的菜单我的网页,以及在WordPress?
谢谢
答
澄清你的问题。你想在WordPress管理员中编辑这些HTML页面吗?你不能。页面必须是WP后端的一部分,并驻留在数据库中,以便在编辑器中进行编辑。
如果您只是希望将这些页面链接到WP页面的菜单中,那么它们必须作为链接在header.php(或其他页面模板)中进行硬编码,因为无法通过wp_list_pages调用静态html页面或其他WP php功能。
答
” ......花费约-us.html网页的源文件,这 我在Dreamweaver中创建,进入 WP-管理员,网页,添加新页面和下降 HTML代码到HTML标签内 的
标签......”
您可以做到这一点。但不要使用<代码> < /代码>标签(或页面会显示你的“原始” HTML)
它应该是这样的:
- 创建一个新的页面,标题“关于”。
- 复制和源代码,是<体内> < /身体原来的“about.html” >标签粘贴到HTML编辑器(请确保您在“HTML”模式 - 不是“视觉“)
(注:<脚本>标签(和一些其他的标记)。将WP当您提交的页面被剥离)
- 你” 菜单运tions“(我认为这是你的导航?)不能指向”about.html“,因为它可以作为一个动态的WP控制页面。无论如何,您的新“关于”页面可能会出现在导航栏中。
答
You can convert your html pages to wordpress pages by using template pages for your
each menus.Before that create files name header.php,index.php,sidebar.php,footer.php
,style.css in your theme folder.Then follow the below steps:
1. Include all the contents of your home.html upto your menu creation like this in your
header.php:
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<title>Course</title>
</head>
<body>
<div id="wrapper">
<div class="w1">
<div class="w2">
<!-- header -->
<header id="header">
<div class="line"></div>
<!-- logo -->
<h1 class="logo"><a href="#">Company Logo</a></h1>
<!-- main nav -->
<nav id="nav">
<!--**replace your menu listings by the given below codes**-->
<?php wp_nav_menu(array('theme_location' => 'primary')); ?>
</nav>
<div class="clear"></div>
</header>
<?php wp_head(); ?>
2. In index.php, include the body contents of home.html
in between the below codes:
<?php
/**
* Template Name: home
*
* Selectable from a dropdown menu on the edit page screen.
*/
?>
<?php get_header(); ?>
//body contents of home page
<?php get_footer(); ?>
3.Likewise, you can include as much menu you want.Just by changing like this for about
us:
<?php
/**
* Template Name: aboutus
*
* Selectable from a dropdown menu on the edit page screen.
*/
?>
<?php get_header(); ?>
//body contents of aboutus page
<?php get_footer(); ?>
4. If you have any footer contents(contents needed to display at the bottom of all
pages).Then include the contents in footer.php.If no contents is there,then
also simply create a file named footer.php.
5. Include the side contents to sidebar.php(contents to be displayed in right side of
the page).If no side contents are there.Then,simply create sidebar.php.
5. style.css,containing the css for all pages.
6.After creating all html files to .php files.Open the admin dashboard of your website.
In that open,Pages->Add new.In Add New Page,Enter the menu name(Home) in title and in
right side,click the Template dropdown and select the template name(home) and click
Publish button.
7.Likewise,create pages for all menus by giving title and selecting template name from
the template dropdown and click publish button after selecting.
8.Then,open Appearance->Menus.Then Menus page will open,in that on left side corner,you
will see Pages tag,click view all and check all the pages you want to display as
menus in your website and click Add to Menu button.
9.Then,the selected pages will be shown on right side,in bottom you will see Save Menu
button,click it.
8.After finishing all,on top left corner click on the website name and see the website
with the following menus and their corresponding pages.
嗨@songdogtech,我deinitely想我的网页是由最终用户,即文本编辑,添加/删除图像等会很感激做到这一点的最好办法还是请点我一个展示这一点的网站。谢谢。 – tonyf 2010-08-16 14:11:04
嗨@songdogtech - 我对你的评论有些困惑:“页面必须是WP后端的一部分,并驻留在数据库中,以便在编辑器中编辑。”所以我明白,你是说我只是不能采取一个about-us.html页面源,我已经在Dreamweaver中创建,进入WP-Admin,页面,添加新页面并将html代码放入html选项卡在
标签内,这些标签还可能包含图像供我稍后再次更新?如果不是,我该怎么办,因为这些页面不会是静态页面?谢谢。 – tonyf 2010-08-16 14:29:53