将 HTML 页面添加到 WordPress 中

发布于 2024-09-14 07:31:30 字数 443 浏览 3 评论 0原文

在我要转换为 WordPress CMS 主题的网站中,有 7 个菜单选项可转到各个 html 页面。

我的问题是,将这 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 中将我的菜单链接到我的页面?

谢谢

Within my website that I am converting over into a WordPress CMS theme, there are 7 menu options that go to individual html pages.

My question is, what is the best way to get these 7 html pages into my WordPress CMS theme, i.e. is there a backend means or do I directly add these individual pages as the WordPress Admin?

I've currently got my menu options setup as follows:

<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>

Also, how do I link my menu to my pages as well in WordPress?

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

青萝楚歌 2024-09-21 07:31:30
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.
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.
套路撩心 2024-09-21 07:31:30

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

如果您只想将这些页面链接到 WP 页面的菜单中,则必须将它们硬编码在 header.php(或其他页面模板)中作为链接,因为静态 html 页面不能被 wp_list_pages 或其他 WP php 调用功能。

Clarify your question. Do you want to be able to edit those html pages in WordPress admin? You can't. Pages have to be part of the WP backend and reside in the database to be editable in the editor.

If you just want those pages to be linked in the menus of the WP pages, they must be hardcoded in the header.php (or other page templates) as links, as static html pages can't be called by wp_list_pages or other WP php functions.

甜`诱少女 2024-09-21 07:31:30

“...获取 about-us.html 页面源代码,
我已经在Dreamweaver中创建了,进入
WP-管理、页面、添加新页面和删除
将html代码放入html选项卡内
标签...”

可以这样做。但不要使用 标签(或页面将显示您的“原始”html。)

它应该是这样的:

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

注意:

  • 您的“菜单选项”(我假设这是您的导航?)无法指向“about.html”以使其作为动态的 WP 工作无论如何,您的新“关于”页面可能会出现在导航中。

"...take a about-us.html page source, that
I have created in Dreamweaver, go into
WP-Admin, Pages, Add New Page and drop
the html code into the html tab within
the tags..."

You can do that. But do not use the <code></code> tags (or the page will display your "raw" html.)

It should go something like this:

  • Create a new page, title "About".
  • Copy and paste the source code that is inside the <body></body> tag of your original "about.html" into the html editor (make sure you are in "html" mode -- not "Visual".)

(NOTE: <script> tags (and some other tags) will be stripped by WP when you submit the page.)

  • Your "menu options" (I assume this is your navigation?) can't point to "about.html" for this to work as a dynamic, WP-controlled page. Your new "About" page will likely appear in the navigation, anyway.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文