2010-08-16 198 views
1

在我的網站中,我將其轉換爲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?

謝謝

回答

0

澄清你的問題。你想在WordPress管理員中編輯這些HTML頁面嗎?你不能。頁面必須是WP後端的一部分,並駐留在數據庫中,以便在編輯器中進行編輯。

如果您只是希望將這些頁面鏈接到WP頁面的菜單中,那麼它們必須作爲鏈接在header.php(或其他頁面模板)中進行硬編碼,因爲無法通過wp_list_pages調用靜態html頁面或其他WP php功能。

+0

嗨@songdogtech,我deinitely想我的網頁是由最終用戶,即文本編輯,添加/刪除圖像等會很感激做到這一點的最好辦法還是請點我一個展示這一點的網站。謝謝。 – tonyf 2010-08-16 14:11:04

+0

嗨@songdogtech - 我對你的評論有些困惑:「頁面必須是WP後端的一部分,並駐留在數據庫中,以便在編輯器中編輯。」所以我明白,你是說我只是不能採取一個about-us.html頁面源,我已經在Dreamweaver中創建,進入WP-Admin,頁面,添加新頁面並將html代碼放入html選項卡在標籤內,這些標籤還可能包含圖像供我稍後再次更新?如果不是,我該怎麼辦,因爲這些頁面不會是靜態頁面?謝謝。 – tonyf 2010-08-16 14:29:53

0

」 ......花費約-us.html網頁的源文件,這 我在Dreamweaver中創建,進入 WP-管理員,網頁,添加新頁面和下降 HTML代碼到HTML標籤內 的標籤......」

可以做到這一點。但不要使用<代碼> < /代碼>標籤(或頁面會顯示你的「原始」 HTML)

它應該是這樣的:

  • 創建一個新的頁面,標題「關於」。
  • 複製和源代碼,是<體內> < /身體原來的「about.html」 >標籤粘貼到HTML編輯器(請確保您在「HTML」模式 - 不是「視覺「)

注:<腳本>標籤(和一些其他的標記)。將WP當您提交的頁面被剝離)

  • 你」 菜單運tions「(我認爲這是你的導航?)不能指向」about.html「,因爲它可以作爲一個動態的WP控制頁面。無論如何,您的新「關於」頁面可能會出現在導航欄中。
1
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.