2017-02-22 50 views
-1

我在我的服務器上安裝了wordpress,我在服務器上有另一個腳本,但是有另一個目錄。如何將wordpress菜單添加到我的腳本頁面?Wordpress菜單到另一個頁面

回答

0

您可以使用簡單的HTML DOM,你會做類似下面這樣做:

<?php  
    $html = str_get_html("YOUR WORDPRESS SITE URL"); 
    $elem = $html->find('div[id=wrapper_content]', 0);//wrapper_content is you wordpress menu id  
    //right 
    $file_contents = curl_exec($ch); //get the page contents 
    preg_match($s_searchFor, $file_contents, $matches); //match the element 
    $file_contents = $matches[0]; //set the file_contents var to the matched elements 
?> 

將這個代碼的情況下,你已經創建菜單腳本。這會讓你的wordpress菜單變成$file_contents變量,而你的菜單應該變成echo $file_contents;

相關問題