我使用這個代碼:語法錯誤在WordPress
if (in_category('finance')) {
include(TEMPLATEPATH.'/category1.php');
} elseif (in_category('2')) {
include(TEMPLATEPATH.'/category2.php');
} else {
include(TEMPLATEPATH.'/default.php');
}
一切工作正常。當我有名稱財務類別時,將使用category1.php中的模板。
但現在我想包括一個選項,要求這樣的基於特定模板文件:
<?php echo $up_options->category1; ?>
所以我插入選項請求代碼爲第一碼是這樣的:
if (in_category('finance')) {
include(TEMPLATEPATH.'/$up_options->category1;');
} elseif (in_category('2')) {
include(TEMPLATEPATH.'/single2.php');
} else {
include(TEMPLATEPATH.'/category1.php');
}
我得到下面的錯誤與上面的代碼:
[function.include]: failed to open stream: Invalid argument in.....
真是一個ppreciate任何幫助。
謝謝。
謝謝,忍者。不幸的是你的代碼無法正常工作,同樣的錯誤仍時有發生。 –