2012-10-06 24 views
1

我使用20的十一我的主題我創建一個PHP頁面下它命名爲這裏的results.php results.php是我的代碼:爲什麼我有錯誤使用wordpress調用未定義的函數get_header()?

<?php 

get_header(); ?> 

<?php get_footer(); ?> 

從我的index.php:

<?php get_header(); ?> 
<a href="wp-content/themes/twentyeleven/result.php">Main</a> 
<?php get_footer(); ?> 
+0

你在用'result.php'文件製作一個自定義頁面嗎? –

+0

yes ---........ –

+0

你能否給我們提供一些關於問題點的更多細節。因爲,就我看到的方式而言,如果您使用的是正確的二十一個模板,則可以使用http://yourdomain.com/result.php –

回答

1

如果你正在對WordPress的自定義頁面,

然後,你必須模板名稱在result.php設置到您的文件,如:

<?php 
    /* Template Name: Result */ 
    get_header(); 

    // Rest Stuff for result.php 

    get_footer(); 
?> 

希望這將解決你的問題..

UPDATE:請不要使用你在你的index.php文件中給出的東西像

<a href="wp-content/themes/twentyeleven/result.php">Main</a>

由於直接鏈接您直接撥打result.php,但最好的方法是從後端創建名稱爲Main的頁面,併爲該特定頁面選擇Result主題。

+0

錯誤仍然存​​在: –

+0

@SuiGo請檢查更新 –

+0

所以我會在我的href? –

相關問題