首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >将超文本标记语言页面添加到WordPress

将超文本标记语言页面添加到WordPress
EN

Stack Overflow用户
提问于 2010-08-16 12:29:44
回答 3查看 7.7K关注 0票数 1

在我的网站上,我正在转换成一个WordPress的内容管理系统主题,有7个菜单选项,去个别的html页面。

我的问题是,什么是最好的方式让这7个WordPress页面进入我的WordPress内容管理系统主题,即是否有一个后端的方式或我直接添加这些单独的页面作为管理?

我目前的菜单选项设置如下:

代码语言:javascript
运行
复制
<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中将菜单链接到我的页面?

谢谢

EN

回答 3

Stack Overflow用户

发布于 2012-06-25 19:18:37

代码语言:javascript
运行
复制
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.
票数 1
EN

Stack Overflow用户

发布于 2010-08-16 21:37:02

澄清你的问题。您希望能够在WordPress管理中编辑这些html页面吗?你不能。页面必须是可湿性粉剂后端的一部分,并驻留在数据库中,才能在编辑器中编辑。

如果你只是想在可湿性粉剂页面的菜单中链接这些页面,它们必须在header.php (或其他页面模板)中硬编码为链接,因为静态html页面不能被wp_list_pages或其他可湿性粉剂php函数调用。

票数 0
EN

Stack Overflow用户

发布于 2010-08-17 12:43:08

“打开我在Dreamweaver中创建的about-us.html页面源代码,进入WP-Admin,Pages,Add New page,并将html代码放入标记内的html选项卡中...”。

你可以通过来做到这点。但是不要使用标签(否则页面将显示您的“原始”html)。

它应该是这样的:

  • 创建一个标题为“About”的新页面。
  • 将原始"about.html“的标记内的源代码复制并粘贴到html编辑器中(确保您处于”about.html“模式,而不是”可视“模式。)

(注意:当您提交页面时,标签(和其他一些标签)将被WP剥离。)

  • 你的“菜单选项”(我假设这就是你的导航?)无法指向"about.html“以使其作为动态的、WP控制的页面工作。无论如何,您的新“关于”页面很可能会出现在导航中。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3490597

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档