添加自定義簡(jiǎn)碼后服務(wù)器錯(cuò)誤 500
添加自定義短代碼后出現(xiàn)服務(wù)器錯(cuò)誤 500,,,,,,,,,我快瘋了! !我需要您的幫助,因?yàn)槲艺趪L試生成一個(gè)短代碼以將其顯示在產(chǎn)品頁(yè)面的產(chǎn)品標(biāo)題下。此短代碼應(yīng)顯示特定屬性。一切正常,但是當(dāng)我嘗試保存時(shí),服務(wù)器錯(cuò)誤為 500。我必須從 .php 中刪除代碼。代碼如下: () { $;$ = array( '-ml','' );$
我要瘋了! !我需要您的幫助,因?yàn)槲艺趪L試生成一個(gè)短代碼以將其顯示在產(chǎn)品頁(yè)面的產(chǎn)品標(biāo)題下。此短代碼應(yīng)顯示特定屬性。一切正常,但是當(dāng)我嘗試保存時(shí)wordpress 添加短代碼wordpress 添加短代碼wordpress網(wǎng)站建設(shè),服務(wù)器錯(cuò)誤為 500。我必須從 .php 中刪除代碼。代碼如下:
function add_attribute() {
global $product;
$product_attributes = array( 'pa_formato-ml','pa_colore' );
$attr_output = array();

// Loop through the array of product attributes
foreach( $product_attributes as $taxonomy ){
if( taxonomy_exists($taxonomy) ){
$label_name = get_taxonomy( $taxonomy )->labels->singular_name;
$value = $product->get_attribute('Formato ml');
if( ! empty($value) ){

// Storing attributes for output
$attr_output[] = ''.$label_name.': '.$value.'';
}
}
}
// Output attribute name / value pairs separate by a "
"
echo ''.implode( '
', $attr_output ).'
';

}
add_shortcode('show attribute', 'add_attribute');
函數(shù)添加_屬性(){
全球$產(chǎn)品;
$product_attributes=數(shù)組('pa_formato-ml','pa_colore');
$attr_output=array();
//循環(huán)遍歷產(chǎn)品屬性數(shù)組

foreach($product_屬性作為$TAXINORYOM){
如果(分類法_存在($taxonomy)){
$label\u name=get\u taxonomy($taxonomy)->labels->singular\u name;
$value=$product->get_屬性('Formato ml');
如果(!空($value)){
//存儲(chǔ)輸出屬性
$attr_output[]='.$label_name.':'.$value.';
}

}
}
//以“
”分隔的輸出屬性名稱/值對(duì)
回顯“”。內(nèi)爆(“
”,$attr\u輸出)?!啊?;
}
添加快捷碼(“顯示屬性”、“添加屬性”);
感謝您的幫助
您檢查過(guò)服務(wù)器的錯(cuò)誤日志嗎?如果是,它會(huì)說(shuō)什么?如何檢查錯(cuò)誤?感謝您的幫助 :) 一般來(lái)說(shuō),在托管服務(wù)提供商提供的控制面板中有一個(gè)名為錯(cuò)誤日志(或類似內(nèi)容)的專用部分,您可以在其中訪問(wèn)這些日志?;蛘?a href='http://m.bjcthy.com/'>wordpress網(wǎng)站制作,您也可以嘗試檢查自己的 debug.log 文件:。
文章來(lái)自互聯(lián)網(wǎng),侵權(quán)請(qǐng)聯(lián)系刪除,文章闡述觀點(diǎn)來(lái)自文章出處,并不代表本站觀點(diǎn)。
m.bjcthy.com