在/wp-admin/theme-editor.php
之內,我添加了一些PHP,試圖創建我自己的短代碼。當我點擊保存:恢復到舊的functions.php文件仍然會產生相同的解析錯誤
Parse error: syntax error, unexpected 'post' (T_STRING) in .../wp-content/themes/phenomenon/functions.php on line 21
事實上,如果我試圖去甚至到我的網站的主要頁面出現同樣的錯誤。沒有辦法回到編輯器並刪除新添加的代碼,我通過FTP上傳了functions.php的備份副本。我的網站再次開始加載。然而,當我進入/wp-admin/theme-editor.php
時,即使functions.php沒有21行代碼,仍會出現此錯誤。
下面是電流/原來的functions.php:
<?php ?><?php
require_once (TEMPLATEPATH."/scripts/theme-js.php");
include (TEMPLATEPATH."/scripts/custom-scripts.php");
include (TEMPLATEPATH."/scripts/breadcrumbs.php");
include (TEMPLATEPATH."/scripts/write-panels.php");
include (TEMPLATEPATH."/bluzpanel/theme_options.php");
include (TEMPLATEPATH."/includes/shortcodes.php");
include (TEMPLATEPATH."/includes/wp-pagenavi.php");
include (TEMPLATEPATH."/includes/custom-widgets.php");
include (TEMPLATEPATH."/includes/register-sidebars.php");
?>
編輯:我覈實,我仍然可以使用/wp-admin/theme-editor.php
當我測試在另一臺計算機上。因此,對於我的主計算機,問題可能是唯一的,我在此對function.php
進行了更改。
有很多'functions.php'文件,很難說沒有完整的路徑,但你可能有一個額外的單引號或雙引號在你修改過的文件中。你也不應該修改核心文件 - 任何不在'wp-content'下的文件。如果您升級WordPress(或者如果您在那裏修改文件,則爲插件),您的更改將被覆蓋。使用Action和Filter掛鉤來擴展功能。 – doublesharp
謝謝。正如你所看到的,我添加了更多的functions.php路徑。 (也許我覺得有一些私密的東西是愚蠢的。)另外我在帖子末尾添加了一個編輯。 – cadsharp